programming

Most Programmers cant solve this (2)

This is the 2nd part of a previous blog post. I have included more programming puzzles which most “programmers” usually fail to solve in programming interviews.

They are sorted in order of increasing complexity.
1. Write a program that prints out in reverse order, every multiple of 3 between 1 and 100.
2. Reverse a string.
3. Reverse a sentence “Bob likes dogs” to become “Dogs likes Bob”. please note the capitalization of the words.
4. Find the minimum value in a list. (hint create your own list of items containing both words and integers)
5. Find the maximum value in the list created in (4).
6. Return distinct values from a list that includes duplicates (i.e. 1, 3, 5, 3, 7, 3, 1, 1, 5) -> (1, 3, 5, 7).
7. Return distinct values from the list in (6) including the number of times each distinct item appears in the list. “(1)3, (3)3, (5)2, (7)1.

P.S: Easter egg: If you are interviewing a horde of “programmers” and want to prune the number by at least 60% give them this puzzle to solve in longhand: “Swap the value of 2 variables”. You would be amazed at the result.

Standard