Category Archives: Programming Interview

Programming Interview Questions 18: Find Even Occurring Element

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

Posted in Programming Interview | 5 Comments

Programming Interview Questions 17: Search Unknown Length Array

Given a sorted array of unknown length and a number to search for, return the index of the number in the array. Accessing an element out of bounds throws exception. If the number occurs multiple times, return the index of … Continue reading

Posted in Programming Interview | Leave a comment

Programming Interview Questions 16: Anagram Strings

Given two strings, check if they’re anagrams or not. Two strings are anagrams if they are written using the same exact letters, ignoring space, punctuation and capitalization. Each letter should have the same count in both strings. For example, ‘Eleven … Continue reading

Posted in Programming Interview | 8 Comments

Programming Interview Questions 15: First Non Repeated Character in String

One of the most common string interview questions: Find the first non-repeated (unique) character in a given string.

Posted in Programming Interview | 5 Comments

Programming Interview Questions 14: Check Balanced Parentheses

Given a string of opening and closing parentheses, check whether it’s balanced. We have 3 types of parentheses: round brackets: (), square brackets: [], and curly brackets: {}. Assume that the string doesn’t contain any other character than these, no … Continue reading

Posted in Programming Interview | Leave a comment

Programming Interview Questions 13: Median of Integer Stream

Given a stream of unsorted integers, find the median element in sorted order at any given time. So, we will be receiving a continuous stream of numbers in some random order and we don’t know the stream length in advance. … Continue reading

Posted in Programming Interview | 8 Comments

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 | Leave a comment

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 | 3 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 | 6 Comments

Programming Interview Questions 9: Convert Array

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

Posted in Programming Interview | 6 Comments