Lead software engineer interview questions shared by candidates
2. Swap the two values (int A=5 and int B=3), w/o using a 3rd attribute(so you cant use the 3rd attribute to store the value as a temporary storage).
first you do A= A*B, next you divide B=A/B and finally A= A/B.
A = A+B B = A-B A = A-B
Both previous answers are theoretically correct, yet buggy. 'A' could potentially overflow due to (A+B) or (A*B). Therefore, the best method is to use the 'xor' operator. A ^= B; B ^= A; A ^= B;
Passengers are waiting to board a fully booked plane. They all have an assigned seat except for one person. They all board the plane in a random order. If their assigned seat is available, they take it. If not, they seat at random somewhere else. When it's her time to board, the one person without a number chooses a seat at random amongst those that are left. The question is: what are the odds that the last person will sit on her assigned seat?
See Interview Questions for Similar Jobs
- Software Engineer
- Senior Software Engineer
- Software Developer
- Principal Software Engineer
- Staff Software Engineer
- Software Development Engineer
- Senior Software Developer
- Senior Software Development Engineer
- Vice President
- Engineering Manager
- Software Engineer III
- Lead Engineer
- Product Manager
- Project Manager
- Senior Manager
- Software Architect
- Senior Staff Software Engineer