Monthly Archives: December 2011

Programming Interview Questions 23: Find Word Positions in Text

Given a text file and a word, find the positions that the word occurs in the file. We’ll be asked to find the positions of many words in the same file.

Posted in Programming Interview | 2 Comments

Programming Interview Questions 22: Find Odd Occurring Element

Given an integer array, one element occurs odd number of times and all others have even occurrences. Find the element with odd occurrences.

Posted in Programming Interview | 7 Comments

Programming Interview Questions 21: Tree Reverse Level Order Print

This is very similar to the previous post level order print. We again print the tree in level order, but now starting from bottom level to the root. Using the same tree as before: The output should be: 4 5 … Continue reading

Posted in Programming Interview | 3 Comments

Programming Interview Questions 20: Tree Level Order Print

Given a binary tree of integers, print it in level order. The output will contain space between the numbers in the same level, and new line between different levels. For example, if the tree is: The output should be: 1 … Continue reading

Posted in Programming Interview | 6 Comments

Programming Interview Questions 19: Find Next Palindrome Number

Given a number, find the next smallest palindrome larger than the number. For example if the number is 125, next smallest palindrome is 131.

Posted in Programming Interview | 3 Comments