Monthly Archives: October 2011

Programming Interview Questions 12: Reverse Words in a String

This is probably by far the most common string manipulation interview question. Given an input string, reverse all the words. To clarify, input: “Interviews are awesome!” output: “awesome! are Interviews”. Consider all consecutive non-whitespace characters as individual words. If there … Continue reading

Posted in Programming Interview | 18 Comments

Programming Interview Questions 11: All Permutations of String

The title says it all, this is a pretty standard interview question. Generate all permutations of a given string.

Posted in Programming Interview | 20 Comments

Programming Interview Questions 10: Kth Largest Element in Array

Given an array of integers find the kth element in the sorted order (not the kth distinct element). So, if the array is [3, 1, 2, 1, 4] and k is 3 then the result is 2, because it’s the … Continue reading

Posted in Programming Interview | 29 Comments

Programming Interview Questions 9: Convert Array

Given an array: convert it to: in-place using constant extra space.

Posted in Programming Interview | 23 Comments

Programming Interview Questions 8: Transform Word

Given a source word, target word and an English dictionary, transform the source word to target by changing/adding/removing 1 character at a time, while all intermediate words being valid English words. Return the transformation chain which has the smallest number … Continue reading

Posted in Programming Interview | 14 Comments

Programming Interview Questions 7: Binary Search Tree Check

This is a very common interview question. Given a binary tree, check whether it’s a binary search tree or not. Simple as that..

Posted in Programming Interview | 15 Comments

Programming Interview Questions 6: Combine Two Strings

We are given 3 strings: str1, str2, and str3. Str3 is said to be a shuffle of str1 and str2 if it can be formed by interleaving the characters of str1 and str2 in a way that maintains the left … Continue reading

Posted in Programming Interview | 57 Comments