There are 25 horses, and each runs at different constant speeds. If you want to find the 5 fastest horses, what is the minimum number of races needed, if each race can have five horses at most?
Developer Interview Questions
270,873 developer interview questions shared by candidates
Find if given text does have matching [ { ( opening and closing. So ({[]}) is valid and ({)} is invalid. They should open and close in proper order.
If you have 2 coins in your pocket (one is double-headed, and the other is a fair coin), you grab a random coin from your pocket and see that one face is a head. What is the probability that if you flip the coin, the other face is also a head (i.e. that you picked the double-headed coin)?
What is a JavaScript callback function?
Onsite interview 1: A paper test, questions including Java syntax, SQL, JavaScript, code review. Java syntax question is: given a method: int exchange(int a), we need: if a == 1 return 2, if a == 2 return 1. Give 4 methods to implement the method, "if" statement cannot be used. SQL question was about nested queries and aggregation. JavaScript question was to write a JavaScript function, when a radiobox is checked then alert sth. Code review question is an implementation of tree level traverse algorithm, lot of errors.
First round is pattern based question like.. n=1 n=2 n=3 * * * *** *** *** * * * * ***** ***** * * * *******
Division without divide operator
Write a function get_hops_from(page1, page2) that will determine the number of hyperlinks that you would need to click on to get from some page1 on the web to some other page2 on the web. For example, if each page below links to the pages that are indented below it, e.g. page 1 links to pages 2 and 5, and page 2 links to pages 3 and 4, and page 5 links to pages 3 and 7, then the get_hops_from(page1, page7) should return 2 (2 hops), since you have to hop once from page 1 to 5 and once more from page 5 to page 7. page1 : distance == 0 page2 : distance == 1 page3 : distance == 2 page4 : distance == 2 page5 : distance == 2 page3 : distance == 2 page7 : distance == 2 Assume that an API is available to: * get_links(a_page) will return an array/list of all pages that a_page links to
Can you optimize the algoritm which you wrote.
Given an array where each entry can be another array, and so forth, flatten the array. [4, [3, 6, [9, 1, 9, [5, 1]]], 8] -> [4, 3, 6, 9, 1, 9, 5, 1, 8]
Viewing 141 - 150 interview questions