The first Jedi question was this: given an unsorted array of numbers, like [1, 3, 5, 4, 2], write a function that takes an integer and returns true if there's any pair of numbers in that array that can be summed up to the input integer.
Sigiloso
Given that this was an iOS interview, I solved this using Objective-C: NSArray *inputArray = @[@1, @3, @5, @4, @2]; - (BOOL) pairOfNumberIn: (NSArray *) inputArray matches: (int) sumNumber { NSMutableDictionary *destinationDict; for eachInput in inputArray { // we know what number we need to sum up to the "seekNumber" seekValue = sumNumber - eachInput.intValue; // if it exists in the destinationDict-ionary, then we can return YES if [destinationDict objectForKey: value] return TRUE; else { // otherwise add this seekValue to the destinationDict [destinationDict setObject: eachInput forKey: [NSNumber numberWithInt: seekValue]]; } } return FALSE; } If we look for 7, the inputArray values of 1, 3 & 5 correspond to 6, 4, & 2. When we hit 4 in the inputArray, we've already calculated that we need a 4 to hit the sumNumber so an object for that key exists and we can return TRUE. I probably could have simplified this down to a NSMutableArray with corresponding seekValues.