Interview Question


Country: United States




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

Think binary !

- learner May 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thanks

- Anonymous May 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

as in ?

- Sairam May 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1
2
4
8
16
32
64


Power(2,x) < 100 ,, x=0,1,2

- Lazy May 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

or mathematical induction

if 1,2,4,...,2^k can form any number between 0 and 2^(k+1)-1

then 1,2,4,...,2^k,2^(k+1) can form:
- any number between 0 and 2^(k+1)-1 (if we dont make use of the last term), and
- any number between 2^(k+1)+0 and 2^(k+1)+ 2^(k+1)-1 (if we make use of the last term)

therefore it can form any number between 0 and 2^(k+1)+ 2^(k+1)-1 = 2^(k+2)-1.

by MI, this stmt is true: 1,2,4,...,2^n can form any number between 0 and 2^(n+1)-1


now we know 1 2 4 ... 32 can form number between 0 and 63. for number between 64 and 100, we can make use of 37, the remainder would be between 27 and 63 which then can be formed by 1 2 4 ... 32

- Hei May 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I didn't get the idea for the numbers between 64-100. Can anyone explain it more clearly.

Thanks in advance :)

- Pranay Singhania May 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

for any n between 64 and 100. we will first pick 37 to "make" n. Then the remaining number,r = n-37, is between 64 - 37 (27) and 100-37 (63). Since r is between 0 and 63, it can be made using 1,2,4,8,...32

- hei May 17, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Can you tell me why you are picking 37 first why not any other number ???

Please Explain it.

Thanks

- Pranay Singhania May 17, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

look my friend the scenario bfor 37,if u add all of them u get a sum of 63.. u need 37 more to get 100,else it will cross 100.
hence we chose 37..

- Anonymous May 18, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Thanks :) Got it

- Pranay Singhania May 18, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ans 1,2,4,8,16,32,37 .
this is d ans u gave.. first of all.. der is no G.P. since 37 is prime no... it cant b ny term of gp.. secondly der is no proper sequence.. its just a concept..
i can give u anodr answer.. 1,2,3,7,14,28,45...
i hope u know the logic...

- rockstar May 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We just need 1 and 2 to make any number . Here also 1 and 2 will definately be there but rest all numbers can be anything which sums up to 100 - 3 = 97 . I think it might be the answer:)

- naveen kumar May 18, 2012 | 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