Sr
BAN USER- 0of 0 votes
AnswersWAP to find nth Fibonacci number. After I wrote the code, had to read it out line by line. then she asked follow up questions like why this method, what other ways you can write the algorithm, etc.,
- Sr in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Coding - 0of 0 votes
AnswersWAP to count the num of possible hops the bunny can make. conditions are -
- Sr in United States
- bunnies are positions of bunnies on a number line
- count the number of valid hops
- A bunny at the position 'a' jumps over bunny at position 'b' and lands at the position c, c = 2b-a
- A bunny can only hop over one other bunny, and cannot land on another bunny.
- There are at least two bunnies.
- The bunnies are in sorted array.
- The bunny can hop in both directions.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Coding - 0of 0 votes
AnswersSimple one to write a program to calculate avg of int array.
- Sr in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Coding
Checked Exceptions are those exceptions that the programmer need to anticipate while coding and provide proper handling in the code. Compiler will give an error if the checked exceptions are not defined while using certain features.
Unchecked exceptions are those exceptions that are generally not anticipated and they occur at run-time. These kind of exceptions are not supposed to be handled by the programmer and should let the jvm terminate in such cases.
It is generally used to close any db connections or remove any object references that are no longer used after the method exits.
Finally block is executed even if there is an exception in the method.
The only time 'finally' block is not executed is if System.exit(0) is called in the try/catch block.
agreed with anshulzunke.
there were no primitive data types in the very first version of Java but this made the java language very slower, because it is expensive to have even the numbers in the object form.
That is when 'primitive data types' were introduced, which is why we can not say java is 100% object-oriented language.
The following question was: This algorithm does work in the intended way, but what is your argument to that it will always work?
- Sr April 03, 2012Means... how do you explain that pop from one stack and push into another will always give us a Queue functionality?