Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

4/28 /2016

HOME

Gold for 7 Days of Work M y Tech In t erviews

CHAL L E NGE

T OP 10

ADVE RT IS E WIT H US

AB OUT

S UB S CRIB E

MYTECHINTERVIEWS
PREPAREFORATECHNICALINTERVIEW

Goldfor7DaysofWork

6Jan10

S EA RCHINT ERV IEWQ UES T IO NS

Search
Tweet Quest ion:Youvegotsomeoneworkingforyouforsevendaysandagoldbarto
paythem.Youmustpaytheworkerfortheirworkattheendofeveryday.Ifyou

RA NDO M

areonlyallowedtomaketwobreaksinthegoldbar,howdoyoupayyourworker?

ExampleofInterviewTestForFrontEnd

(Assumingequalamountofworkisdoneduringeachdaythusrequiringequalamountof

Developers

payforeachday)

BeforeYouTryToGetATechJob,Build

Answer:Thetrickisnottotryandhowtocutinsuchawaytomake7equalpiecesbut

Stuff

rathertomaketransactionswiththeworker.Maketwocutsonthegoldbarsuchthatyou

AnagramsinanArrayofStrings

havethefollowingsizesofbars.
1/7,2/7and4/7.Forconveniencesake,Iwouldjustrefertothebarsas1,2and4.

FO LLO WUS

AttheendofDay1:GiveBar1(You2and4,Worker1)

AttheendofDay2:GiveBar2,TakebackBar1(You1and4,Worker2)

INT ERES T ING REA DS

AttheendofDay3:GiveBar1(You4,Worker1and2)

Wheredidarcadegamesgo?

AttheendofDay4:GiveBar4,TakebackBar1andBar2(You1and2,Worker4)

CA T EG O RIES

AttheendofDay5:GiveBar1(You2,Worker1and4)

Array(1)

AttheendofDay6:GiveBar2,TakebackBar1(You1,Worker2and4)

BitManipulation(4)
Challenge(5)

AttheendofDay7:GiveBar1(YouEmpty,Worker1,2and4)

General(15)

Thatshouldtakecareofeverything.

LinkedLists(4)
Pointers(5)

Ifyouhaveanyquestions,pleasefeelfreetosendmeanemail

Probability(5)

atsupport@mytechinterviews.com.Ifyouhaveanyinterviewquestionswhichyoufeelwould

Programming(15)

benefitothers,Iwouldlovetohearaboutit.

Puzzles(37)
StringManipulation(7)

Relatedposts:

Trees(2)
I. 6Pirat esFight for1GoldCoin

Uncategorized(8)

II. 5Pirat esFight for100GoldCoins


III. 4 Quart sofWat er

A RCHIV ES

IV. ABoxofDefect iveBalls

April2016(1)

V. 12Ident icalBallsProblem

March2016(3)
February2016(10)
February2015(1)

FiledinPuzzles
Taggedc,distribution,gold,puzzle,transcation,tricky,work

10Comments

April2011(4)
March2011(2)
February2011(4)

10Responses

June2010(1)
March2010(4)
February2010(17)

XiPhang

January2010(32)

M AR C H 1 8,2 01 6 AT 7 :30AM

canimeltitthegold??

h t t p://www.m yt ech in t erviews.com /gold-for-7-days-of-work

1/4

4/28 /2016

Gold for 7 Days of Work M y Tech In t erviews

schimschone
D EC EM B ER 1 ,2 01 4 AT 2 :07 P M

Whilethereispossiblysomemeritinaskingthequestion..youknow,seeifan
employeehasacreativeresponsetoabadsituation..theanswerthatappearstobe
wantedisjustplaindaft.
Imean,whatsthepointofpayinganemployeeifyourplanistobartersomeamount
ofwhatyoupaidthembackatsomefuturepoint.Employeestakepaymentfortheir
servicessothattheycaninturnbuythegoodsandservicestheyneedtosurvive..and
thuskeepworkingforyourscroogedass.Theonlyreasononewouldpayan
employeepriortocompletingtheirworkwouldbetosupporttheirneedspriorto
completion.IftheemployeecantspendthemoneybecauseIwilllaterhavetotradeit
backtothem,thenwevenegatedthewholereasonforthetrade.
Thatstatedthen,theresthreerealanswers:First,paythemuponcompletion.Second
paythemoneblockapproximatelyevery3rdofaweek.Orthird,paythemsomeinitial
goodfaithamountwiththerestuponcompletion.
Yes,whileIrealizethisposesamathematicalproblembeggingforanefficientanswer,
aspartofaninterviewforanythingotherthanamathspecificpositionitshowsa
completelackofgroundinginreality.Doreallywanttohiresomeonewhoisso
groundedinefficiencythattheyllneveractuallybeabletonegotiateastrategywith
anotherhumanbeingbyaccountingforthatpersonsneeds?

Yash
AP R IL 6 ,2 01 1 AT 1 0:2 6 AM

Initiallybreakthe7segmentblockintofollowingsegments
i(blocksegment)
ii(blocksegment)
iiii(blocksegment)
1day>Givei(blocksegment)
2day>Giveii(blocksegment)&
takebacki(blocksegment)
3day>Givei(blocksegment)
4day>Giveiiii(blocksegment)&takebacki,iiblocksegments
5day>Givei(blocksegment)
6day>Giveii(blocksegment)&
takebacki(blocksegment)
7day>Givei(blocksegment)

TalAchit uv
AP R IL 1 ,2 01 1 AT 6 :4 0AM

Whenyoureaskedthisduringaninterview,yourthoughtprocessshouldbe:
1)Ineedtocutthebarinto7equalpieceswithonlytwocuts.Thisisclearly
impossible.
2)Letsrestatetheproblem:
Theworkerneedstohave1/7ofabarattheendofday1and2/7ofabarattheend
ofday2,andsoon
Whiletheoriginalassumedrequirementwasclearlyimpossibletosatisfy,thisre
statedoneisnotimpossibleoratleastitisnotasclearthatitisimpossible

h t t p://www.m yt ech in t erviews.com /gold-for-7-days-of-work

2/4

4/28 /2016

Gold for 7 Days of Work M y Tech In t erviews

Youshouldtrytofigureoutawayofsolvingitorprovingthatitaswellisimpossible.
Hopefullywhiletryingtodothatyoullthinkoftheoptionoftransactions.

Ace
M AR C H 1 2 ,2 01 1 AT 4 :1 7 P M

whatifIspentthegoldbytheendofthenextday?

Candy
M AR C H 4 ,2 01 1 AT 1 1 :5 7 AM

@Docsorry,ifyougototheshop,havetopay3$ butonlyhavea10$ bill,dont


yougivethemthe10$ billandexpect7$ back!??!
Thesolutioniscorrect

sailee
N OVEM B ER 2 9,2 01 0AT 4 :03P M

disisdsameanswerithoughtfordispuzzle
imconvinced.

IQ250
SEP T EM B ER 2 7 ,2 01 0AT 5 :1 2 AM

Youmustpaytheworkerfortheirworkattheendofeveryday.
FirstwearegivingthemmorethantheirwagesandthenafterrealiZintakinthm
bak
watdhellisdis??

Doggie
J U N E9,2 01 0AT 1 1 :03P M

Isntlikeaskingforchange?
You:Doyouhavechangefor2/7ofagoldbar?
Worker:OfcourseIdo,hereyougo

Doc
J U N E9,2 01 0AT 1 0:2 2 P M

Whowouldansweritthisway?Idontseewhyanyonewouldthinkabouttakingmoney
backfromsomeoneyoupay?Youcantcountonthemoneybeingthereonday2,3,
etc.Peoplehaveahabitofspendingmoney.

LeaveaReply
Name
Mail

h t t p://www.m yt ech in t erviews.com /gold-for-7-days-of-work

3 /4

4/28 /2016

Gold for 7 Days of Work M y Tech In t erviews

Website

SubmitComment

UsingGravatarsinthecommentsgetyourownandberecognized!
XHT ML:Thesearesomeofthetagsyoucanuse:<a href=""> <b> <blockquote>
<code> <em> <i> <strike> <strong>

MyTechInterviewsispoweredbyWordPressusingthemeTribune

h t t p://www.m yt ech in t erviews.com /gold-for-7-days-of-work

4/4

You might also like