Find if given text does have matching [ { ( opening and closing. So ({[]}) is valid and ({)} is invalid. They should open and close in proper order.
Software Developers Interview Questions
96,321 software developers interview questions shared by candidates
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)?
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.
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.
You are given two integers, p and q. Complete the function calculatePower which takes two integers as arguments and returns p to the power of q, without using the built-in power function. We expect you to do better than O(q). A same input is p = 2 and q = 3, and the corresponding output is 8. Constraints: 0 <= p^q <= ((2^63) - 1)
Reverse an array
Can you cover an 8x8 chess board with dominos if two corner squares are removed (not two from the same side, 2 diagonal from each other). A domino covers 2 squares and no dominos can hang over the side of the board.
Given 10 cups to locate the bottle poisoned wine from a batch of normal ones, you can make any mixture of them and test your mixtures by mouses. However the density of poison in the mixture, the testing mouse will certainly die. And you must give all the mixtures of the 10 cups before the test. There is only one poisoned bottle. How many bottles of wine you can test at most?
Viewing 61 - 70 interview questions