Guruji Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

Interviewer expected ans should be in O(1) as the best one.

- hehe June 09, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Let num be the original number or the sequence of bits...
Do num2 = num - (num - 1)
difference = num2 - num
represent difference as power of 2... then the power gives the poisition of the bit sequence where first 1 appears if you start from that LSB end.

- Adi September 06, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

let num = 11111111111111100000000000000000000000000
a=num-1 = 11111111111111011111111111111111111111111
b=num^a = 00000000000000111111111111111111111111111
(b>>1)+1= 00000000000000100000000000000000000000000//answer

- mail2vcp@gmail.com October 01, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I understood the solution but I did not understand that how we can calculate the power of 2 because for calculating the power we will need to iterate the whole sequence which will result in O(n) not O(1).

- Anonymous November 05, 2008 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More