Determine if an array from 1..n has a duplicate in constant time and space.
Software Interview Questions
550,499 software interview questions shared by candidates
Find number of ones in an integer.
Write a function(int[]) -> int that returns the lowest unassigned integer. For example [] -> 1 (empty set), [1] -> 2, [5, 3, 1] -> 2. Basically just sort the array, iterate, and compare current and previous. If there is a gap then that's your number.
The first question he gave me was not hard. 1. You call to someone's house and asked if they have two children. The answer happens to be yes. Then you ask if one of their children is a boy. The answer happens to be yes again. What's the probability that the second child is a boy? 2. (Much harder) You call to someone's house and asked if they have two children. The answer happens to be yes. Then you ask if one of their children's name a William. The answer happens to be yes again.(We assume William is a boy's name, and that it's possible that both children are Williams) What's the probability that the second child is a boy?
If you have an unsorted array of numbers from 1-100, except 1 of those numbers is missing, how do you determine which number is missing
Print a binary tree by vertical level order like 1 2 4 3 5 print : 3 2 1 5 4
Given a string find the first non-repeated character.
given an array of numbers to remove the duplicates
The questions were not very difficult but you really need to have all the concepts crystal-clear and be ready to apply them successfully. One of the questions was "how to count the letters in this string:" "The quick brown fox jumps over the lazy dog";
Viewing 91 - 100 interview questions