Write a function that takes 2 arguments: a binary tree and an integer n, it should return the n-th element in the inorder traversal of the binary tree.
Software Engineer Interview Questions
466,396 software engineer interview questions shared by candidates
Nothing unexpected, I solved all the problems but I think I was too slow on the first one, which goes like: Given an array of numbers, they are arranged so that the a[0] is in the 1st bucket, a[1]a[2] are in the 2nd bucket, a[3]a[4]a[5] is in the 3rd bucket and so on. The question is then: given a number, you need to return if it is in any bucket or not.
Given a string with parenthesis like "()()(()(()()", check to see if there are matching pairs. If there are matching pairs, return true, else return false. For example, ()()() returns true, ()()()) returns false.
Given a integer , return corresponding ASCII char representation without using language building in feature. ex. input interger 1234, return "1234" in string or characters
Given a sorted array, where each element but one occurs only once, return the element that repeats. (For example, given 1, 2, 3, 3, 4, return 3. Given 1, 2, 3, 4, 6, 6, 7, 8, 9, return 6.)
Given an large list of unsorted numbers, find the smallest number. You can access the list only 3 numbers at a time, and keep moving forward 1 number at a time.
implement a O(1) min function for Stack
Giving a windows size K and an array of size N, find the minimum of each window as it slides through the array.
* You have a data structure of integers, which can be negative, zero, or positive, and you need to support an API with two public methods, insert(int) and getmedian(). Describe a data structure you would use to support this API and describe the running time of the two methods. * Imagine you're writing a function that takes an array of integers and an integer and it needs to return true if any pair in the array sum to the 2nd argument. The array can have negative numbers, zero, or positive numbers. Describe how you would design this function and what its running time would be. I ran through the trivial n^2 solution, then modified it to an nlogn and finally to a linear solution.
How would you implement a stack with the additional operation of getMin?
Viewing 281 - 290 interview questions