Microsoft Interview Question for Interns


Country: United States
Interview Type: Phone Interview




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

You break the bar so that you get 1 peace, 2 peaces and 4 peaces.
**** | ** | *
first day you give 1 peace
2dn you give the one with 2 and get back the other with only 1
3rd you give the 2 and 1
4.- you give the one with 4
5.- 4 & 1
6.- 4 & 2
7.- All

- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> November 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i have a formulae for this question,

first you have to cut 1kg default, then multiply the current segment by 2 till you reaches the highest.

for 7 segment,

1 (1*2) (2*2) = 1 2 4

for 15 segment

1 (1*2) (2*2) (4*2) = 1 2 4 8

- Anonymous November 18, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

This question can be thought of as a specialized case of the generalized problem set :
Given a rod of length n, divide it into minimum number of parts such that you can generate a rod of each length from 1 to number n. For given n, 2^m<= n < 2^(m+1) , number of cuts will be m and hence numbers of parts will be m+1. In present case n=7 lies in the range [4,8), so number of cuts(divide/break) = 2 (It is true not only for 7 but all the numbers from 4 through 7) and parts = 1,2,4 (for 7).

- Rakesh Roy November 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1, 2, 4

- Jason November 15, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thank you David!

- oxymoron November 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Cut the bar Across the segment num-3 which will give u chain (1)-(2) ,, 3rd-segment and the rest (4)-(5)-(6)-(7) ....
1st day-give 3rd segment
2nd day-give chain 1-2 and get 3rd segment
3rd day(u have 3rd and chain 4-5-6-7): so give 3rd segment
4th day:give chain 4---7 and get 3rd and chain 1-2
5th day u have(3rd and chain1-2):so give 3rd segment
6th day- give chain 1-2 and get back 3rd segment
7th day: Give 3rd segment

- Neta_Ji November 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

this is just like counting in binary base.
notice that for 7 days we need log(7) (rounded upwards)= 3 parts. each of those parts will be represented by a binary bit.
the smallest part (1) is the LSB, the largest part (4) is the MSB.
where the number 000 represents that the emplyee has 0 of the fisrt part(which is of size 2^0=1), zero of the second part(which is of size 2^1=2) and zero of the third part(which is 2^2 = 4). respectively, on the seventh day of the week the employee will have all parts, so the binary number will be 111. during the days of the week, the emplyee will have an increacng amount of parts like a binary counter: 000,001,010,011,100,101,110,111.
the first bit is 1 iff the emplyee has part1. the second bit is 1 iff the employee holds that second part (2). the third bit (which is the MSB) is 1 iff the employee holds the third part.
it made it easier for me to think about it that way. hopefully to you too.

- nirorman December 09, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

You have to cut it in 1gm, 2gm, abd 4gm pieces.

- Sanoj May 20, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ans is 1gm, 2gm and 4gm.

- sanoj.kashyap May 20, 2017 | 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