Samsung Interview Question for Developer Program Engineers Financial Software Developers


Team: any
Country: United States
Interview Type: In-Person




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

there is one more way .. fill 3ltr jar with 5ltr jar ... now 2ltr left in 5ltr jar .. empty 3ltr jar and fill it with the liquid left in 5ltr jar .. now 5ltr jar is empty .. fill it again and completely fill the 3ltr jar ie. the 1ltr left in it ... so now 5ltr jar contain 4ltr ..

- mAn1Ac March 25, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
4
of 6 vote

This the the answer I gave it in interview and it worked for me... not sure if other interviewers will accept this solution.

Fill 3 Liter Jar
Pour it into 5 Liter jar
Fill 3 Liter Jar Again
Pour it into 5 Liter untll it's Full (Since it already had 3 Liter + 2 Liter jar will be full)
The 3 Liter will have exactly 1 Liter left.
Pour the 5 Liter Jar water out,
Put the water in 3 Liter to 5 Liter (Now 5 Liter jar will have 1 liter of water)
Now Fill 3 Liter water onto 3 Liter jar and put it onto 5 Liter jar.

The interviewer asked me, so, where are you getting the water from, since you are throwing away the water. I replied I am assuming we have a Tap source of water, since you did not mentioned it in the question.

The interviewer accepted it.

- Kiran Kumar S June 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

one more solution is possible if the containers are perfectly cylindrical.Fill both containers to their full capacity and then tilt them till the water surface is aligned with its diagonal.Doing this will spill exactly half water from the container and exactly half will be left in both the containers.i.e., 5/2 = 2.5 and 3/2 = 1.5 which adds upto 4lts. In this way wastage of water will also be minimum.

- shubham March 27, 2019 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

Assuming we can take another bucket to fill the measured quantity.

i. Fill the 3 litre bucket
ii. Pour the filled 3litre bucket to 5litre bucket ( Now 5litre bucket has 3 litres filled and 2 litres empty )
iii. Fill 3 litre bucket.
iv. Fill 5litre bucket with 3litre till it is full. ( Now 5 litre bucket is full and 3 litre bucket has 1 litre)
v. Pour 1litre of 3 litre bucket to new bucket.
vi. Fill 3 litre bucket and pour it into new bucket.

Finally we have 4 litres in new bucket

- Badam Santhosh June 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
2
of 4 votes

Hi,
Your 1st and 2nd solutions are actually good.
there is a general solution given 'a' sized bucket and 'b' sized bucket.

result (in litres ) = a * X + b * Y ( where X and Y are Integers )
Ex : a = 3, b = 5 result = 4
4 = 3 * (-2) + 5 (2)
In Words : in the whole process of getting 4 litres, we will fill 5 sized bucket 2 times and empty 3 sized bucket 2 times.

- Pavan kumar thati June 11, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Hey,
Wont the solutions depend on the sequence in which you fill or empty the cups? If that is true, is a general solution as above correct?
P.S. I could find only two solutions. Is a third one possible?

- nutty June 11, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

first fill 5litr with 3ltr then again fill it with 3litr '1' lit remains in 3litr then empty 5litr and fill it with 1litr in 3litr can ten now fill 5lit with '3li't we get 4litrs

- ganeshsaicharanrao March 28, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Fill 5 ltr Jar and pour it into 3 ltr Jar. 2 ltrs is left in 5 ltr Jar. Empty the 5 ltr Jar into third container. Repeat above steps 2 times. Third container is left with 4 ltrs

- sekhar pedamallu April 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Fill 5 ltr Jar and pour it into 3 ltr Jar. 2 ltrs is left in 5 ltr Jar. Empty the 5 ltr Jar into third container. Repeat above steps 2 times. Third container is left with 4 ltrs

- sekhar pedamallu April 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hi Nikhil, I too faced the same question some times back with another organization but it was little different, in the sense, that, you can not use any extra bucket or jar, you have to do this with only 2 jars, one 5 ltr capacity and the other 3 ltr capacity with no labels or markings on the surface of the jars or bottles. I am also waiting if anybody can let me know that with only two jars how one can achieve the same that is 4 ltr as result.

- S@iR@m June 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Fill the 5 liter bucket, then pour it into the 3 liter until its full. Then you have 2 liters left in the Bigger bucker

- mohd.husn001 June 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1. fill 5 ltr bucket and pour 3 ltr in 3ltr bucket
2. empty 3ltr bucket.
3. pour 5 ltr water to another bucket.
repeat two times..

- Anonymous June 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

i)fill 5 ltr and pour it into 3 ltr
ii)empty 3ltr and pour water in 5ltr bucket to 3ltr bucket
iii)fill 5 ltr again and pour water from 5ltr bucket to 3 ltr
now 5 ltr bucket will have 4 ltrs of water

- Anonymous June 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 8 vote

tilt both of the buckets 45 degrees so when they are filled, it will only fill half of the bucket.

fill them as they are tilted, and 3 liter bucket will have 1.5 liter, and 5 liter bucket will have 2.5 liter.

pour the 1.5 liter in 3 liter bucket into 5liter bucket. Tadaa there is your 4 liter

- Anonymous June 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

if have no idea about 45 degrees.use rope to measure half of both containers

- Anonymous June 12, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

how about the buckets is not normative ?

- Tsao chien June 14, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

as soon as the water is level just touching where the base joins the wall, and just about to pour out of the opening, then it is 1/2 the container. Works with round buckets, jars, bottles, square or oblong tins.

- kk January 20, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

(i) 5->3 = 2 liter
5->3 = 2 liter
(ii) 3->5->3->5 = 1 liter(Repeat this 4 times)
(iii) 3->5->3->5->1->5 = 4 liter

Please comment if this is not correct solution.

- Sharma June 12, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

liked sharma answer
1.fill 5liter bucket pour it into 3lit bucket ,so now 2liters are left in 5litr bucket
2.empty 3litrs bucket and pour 5litrs water in 3litr bucket
3.fill 5liters bucket again and pour water in 3liter bucket until its full
left water in 5liter bucket will count to 4liters

- john June 17, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

{{Solution #1}}
1. fill the 5 ltr water and pour into 3 ltr bucket. (Now 5 ltr bucket have 2 Ltr reaining water)
2.Empthy 3 ltr ucket and pour it by 2 ltr remain in 5 ltr bucket. ( Now 5 ltr bucket empty and
3-ltr bucket is 2 ltr water filled.
3. Now fill the 5 ltr bucket and pour it into 3 ltr. (Now 5 ltr bucket exactly have 4 ltr water.)

- Dev Singh June 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Solution #2:
steps to follow; Left side of comma is 5 ltr bucket and right after comma is 3 ltr bucket.
0,3
3,0
3,3
5,1
0,1
1,0
1,3
4,0

- Anonymous June 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Fill the 5 ltr jar with water and pour it in 3 ltr jar ,throw the water out , Transfer the remaining liq from 5 ltr jar to 3 ltr jar.
Refill the 5 ltr jar and pour it in to 3 ltr jar ...

U ll be left with 4 ltr water in 5 ltr jar

- pras July 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

5,0
2,3
0,2
5,2
4,3

- kanmanikarthikeyans July 14, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

fill 3 put it in 5
again fill 3 put it in 5 at this point 5 litre will be full and 3 lit will have 1 lit
give this 1 litr
fill 3 using 5
give this 3

- Uv August 03, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Why not put the 3 ltr bucket into the 5 ltr bucket, fill it fully that way only 2 ltrs are left in the 5 ltr bucket. pour half of the 5 liter bucket contents and pour 3 liters into the 5 liter bucket?

- jmj.jitha August 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

hi guys......
first fill the 3 litre jar and pour the water into 5 litre jar
then again fill the 3 litre jar and again pour the water into 5 litre jar
now 5 litre jar is full and 3 litre jar have 1 litre water remaining then
empty the 5 litre jar and then pour that 1 litre water from 3 litre jar to 5 litre jar.
now 5 litre jar have 1 litre water and 3 litre jar is empty..after that fill 3 litre jar and pour the water into 5 litre jar
now 5litre jar have 4 litre water.....that sit...

- Pushpendra Singh Chouhan August 29, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1) hold 3L1 bucket over 5L1 bucket. Use another 5L2 bucket and empty it over 3L1, repeat it 2 times. The water in 5L1 bucket will be 4 liters.

2) hold 5L1 bucket over 5L2 bucket. Use a 3L bucket and 9 time pour water in 5L1. The water in 5L2 bucket will be 4 liters.

2) Fill 5L1 and 5L2 then fill 3L1 and 3L2 from these 5L buckets. Finally, put water of both 5L buckets in one which will be 4 liters.

- Nitin Taur September 01, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

put 3L jar in to 5L jar
now this will measure 2L
do it two time

- sikandar kumar October 03, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Step 1: Fully fill the 5L jar and then use this filled one to completely fill 3L jar. Once 3L jar is filled, you have 2L water in 5L jar left. Now, empty 3L jar and transfer the water from 5L into 3L.
Again fill the 5L jar and then transer water from this to #l jar until full. The remaining water in 5L jar that will remain is 4L.

- Rahul Biswas October 12, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Step 1: Fully fill the 5L jar and then use this filled one to completely fill 3L jar. Once 3L jar is filled, you have 2L water in 5L jar left. Now, empty 3L jar and transfer the water from 5L into 3L.
Step 2Again fill the 5L jar and then transer water from this to 3L jar until full. The remaining water in 5L jar that will remain is 4L.

- Rahul Biswas October 12, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I can think of 3 solutions:
1st:- (using 3ltr jar, total water used = 9lts)
fill 3lts jar add to 5lts one fill and other add to 5lts on 1ltr will be left in 3lts jar.remove
water from 5lts jar and put the 1lts left in 3lts jar to it.Now again fill 3lts jar add to 5lts
and u have 4lts.
2nd:-(using 5lts jar, total water required = 10lts)
fill 5ltr jar and fill 3lts jar from it.empty the 3ltr jar .transfer remaining 2ltr from 5ltr jar
3ltr jar fill 5ltr jar again add 1ltr water to 3ltr jar and their u have 4 ltr water in 5ltr jar.
3rd:-(assuming both jar are perfectly cylindrical, total water required = 8lts)
fill both the jar. Now tilt them till the water surface align with the diagonal perfectly.
Doing this will spill exactly half the amount of water out leaving exactly half water in
jars which adds upto 4 ltrs.

- Shubham Balhara March 27, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

845401

- Subhrans December 10, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Doesn't the interviewer have any question other than this?

- Anony June 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

they are getting smarter and smarter and need more solutions, in these case he asked me 3 solutions.

do anybody have 3rd soln.

- Nikhil June 11, 2013 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Hi Nikhil..Here is ur 3rd solution.
5,0
2,3
0,3
3,0
3,3
5,1
0,1
1,0
1,3
4,0

- Raj July 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

this isn't the third solution you just increased the no of steps.

- Anonymous July 11, 2013 | Flag


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