How do you apply Binary Search on 2D array supposed you have 2D array with integers sorted both horizontally and vertically. If you find any occurrence of the value you are looking for you return true else false. What is the complexity?
For example the 2D array could look like the following
1 4 5 6
2 5 7 9
Read Answers(11) | 21,667 Views |
How to remove extra bracket from expressions,i.e ((((A+B))*C))?
most optimized answer??
Read Answers(10) | 14,111 Views |
How to find median of a BST?
constraint: without storing it in a linear data structure by inorder traversal?
Read Answers(8) | 11,573 Views |
You have borrowed money from your friend George. But now, George wants his money back. So you go to your other friend Frank and he writes you a check for the amount you owe George. You make your way to the bank and give the check to the teller. He accidentally mixes up the dollars and cents (for example $20.76 would become $76.20).
That mixup allows you to repay both friends and have $1 left over.
How much did you borrow from each friend?
Read Answers(11) | 18,556 Views |
Given an N x M two dimensional array of integers where all rows and columns are sorted in ascending order, write a function that can determine if a certain value exists in the array.
Read Answers(4) | 8,200 Views |
You have 12 identical looking coins. Only one coin out of the 12 coins is definitely bad, it can be heavier or lighter, we don’t know at this stage.
You have a ( two ) pan balance and are allowed only three tries. You can use any mix of coins in the tries. You can mark the coins to identify them and to not let them get mixed up.
At the end of the third weighing on the pan balance you have to conclusively identify the bad coin and state if it was heavier or lighter than the rest of the coins. ( It may take you days to solve it, there is only one solution )
Read Answers(10) | 14,213 Views |
what is meant by structure ?
application of structure?
difference between structure and unions?
Read Answers(5) | 13,621 Views |
Here’s one I was asked during my interview:
- binary tree, nodes, each node has an ID
- root node of the tree
structure node
{
int id;
node *
left;
node *
right;
}
- problem: given node id 1, and node id 2, determine the
lowest common ancestor of these 2 nodes
- input:
id1, id2, root
- out: node
id of this ancestor node
Read Answers(8) | 26,459 Views |
Create an algorithm that can store 100 business cards and return the information quickly(no external databases), keeping in mind that the company would want to increase the no. of cards later !
Read Answers(3) | 9,050 Views |
How do you plan your day?
Read Answers(12) | 13,558 Views |