Find the deepest common ancestor of two nodes in a tree structure.
Programmer Developer Interview Questions
747,257 programmer developer interview questions shared by candidates
class A { public A() { foo(); } public void foo() { System.out.println("Class A"); } } class B extends A { public B(){} public void foo() { System.out.println("Class B"); } } class main { public static void main(String[] args) { A a = new B(); } } What does it print? Class A or Class B?
Given two strings representing integer numbers ("123" , "30") return a string representing the sum of the two numbers ("153")
You have datastructure my $users = [ { name => 'John', score => 10, }, { name => 'Bob', score => 1, }, { name => 'Carlos', score => 5 }, { name => 'Alice', score => 5, }, { name => 'Donald', score => 7 } ]; now u have to arrange the name with highest to lower score, if score is same than in alphabetical order #expected output: # John # Donald # Alice # Carlos # Bob
Determine if an array from 1..n has a duplicate in constant time and space.
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?
Verify that a binary search tree is indeed a binary search tree.
Viewing 101 - 110 interview questions