To hopefully sidetrack this thread back on to a topic, I thought I'd mention a few of the programming challenges I've been given in job interviews lately.
- Write a function that receives two numbers, then returns an array containing all the primes in between them. Do it efficiently.
- Given an unsorted, even-numbered array of integers, divide the array into two lists of equal size such that their sum is as close as possible.
- Given a solved Sudoku puzzle, validate that it has been solved correctly.
- Come up with classes (including lists of attributes and operations) for a computer version of Connect Four. Then write the function that checks whether the game is in a winning state.
- Write a function that receives two sets (i.e. unordered lists that contain no duplicates). Return all the values in Set 1 that aren't in Set 2.
- Say you have a base-10 number stored as a string. That's a waste of space, as the character values can take 255 values (not including 0/null). Write a function that would convert this string to one with base-255 values stored in each character.