3) Given a N*N array where N is even such as 4, 8 and so on . Print the array from the center. a= [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] the output should be [6 10 12 7 3 2 1 5 9 13 14 15 16 12 8 4 ] .
Software Engineer Interview Questions
467,443 software engineer interview questions shared by candidates
Hardest Q was: Here's a binary tree: find the longest path within it. So, find a path between any two leaf nodes, where the path is the longest.
Closest pair of points problem
Write a method to determine whether two dates are less than a month apart.
second round puzzle(google one) :Four people need to cross a rickety bridge at night. Unfortunately, they have only one torch and the bridge is too dangerous to cross without one. The bridge is only strong enough to support two people at a time. Not all people take the same time to cross the bridge. Times for each person: 1 min, 2 mins, 7 mins and 10 mins. What is the shortest time needed for all four of them to cross the bridge? instead of 7 mins,interviewer said it to be 5 mins :( and expected right answer from me.
Implement an iterator for a binary search tree that will iterate the nodes by value in ascending order.
Given a BST print the nodes at each level on a seperate Line. I could do this easily with a queue ..but he wanted some thing with O(n) time complexity and O(1) space .ie no additional data structure like queues and linkedlists and array lists
find the most frequent element in an integer array
Puzzles:- There are 12 bricks 11 are of same size and one is of different, we have to find the brick with different size in optimal way. (Hint:- Divide And Conquer)
Bubble sort
Viewing 2471 - 2480 interview questions