Pergunta de entrevista da empresa IBM

Question was not difficult. In fact they asked the same queston from almost every interviewee. Qeustion: Given a number N and an array Arr[], search find two numbers which sum up to number N. When you will suggest binary search for this problem. They will ask about the complexity difference between two nested loop and binary search solution. After discussion of algorithm/solution, they will ask you to write down the code on paper. Both interviewers look like of Chinese origin. Only manager got involved in discussion and asked questions. The other one stayed silent. He sounds shy and asocial but was not pyschologist for sure. Maybe he was hired based on his extra-ordinary technical skills or strong internal (possibly Chinese) connection. The whole interviewed lasted for an hour.

Respostas da entrevista

Sigiloso

5 de fev. de 2013

Nested loop: O(N*N), Binary Search: O(N LogN).

1

Sigiloso

23 de abr. de 2015

O(1). minus each number in a new array and use hashmap to search

1

Sigiloso

23 de abr. de 2015

Not O(1) , should be O(N)