Koonz
BAN USER
- 0of 0 votes
AnswersInhouse interview question:
- Koonz
You have an array of char's like so:
[12, 46, 244, 0, 12, 83, 48, 98, 233, 83, 26, 91, 119, 148, 98]
Whats the best way to return the first repeated element. The first one in this case is 12.| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer Data Structures
Using Java (because the job description said to be an expert in it):
float getValue(Node node){
if(node.isLeaf())
return node.value;
else
return node.operand(getValue(node.leftChild), getValue(node.rightChild));
}
Any opinions? With this I assume the node will have functions like isLeaf() and operand(float x, float y) and a value if its a leaf.
So to start, just call getValue(root of tree)
RepHello friends my name Neha Nanda from India Chandigarh city. Doing work in SEO line in Softsys company.
Repcarlawbartlett, Accountant at ASU
Managed a small team managing toy elephants for the underprivileged. A real dynamo when it comes to managing vashikaran mantra ...
Repmarthajpatton, Data Scientist at AppPerfect
Managed a small team implementing gravy in Prescott, AZ. Developed several new methods for easy break up spells.Had some ...
Reprohitrana0777, Animator at AMD
I am work in free lancing as a editor in web developer. I also like play sports. I like kabaddi ...
RepI am Susan From Wasilla USA. and my strong interest in yoga and reading historical books. I have a large ...
RepI am an energetic sales professional with a track record of consistently increasing sales revenue in a competitive market. Contract ...
Now that I think about it, you don't even need a hash. Since we are dealing with priority levels here, you can just have an array of size N where N is all the priority levels.
- Koonz February 14, 2008