tungwaiyip.info

home

about me

links

Blog

< February 2010 >
SuMoTuWeThFrSa
  1 2 3 4 5 6
7 8 910111213
14151617181920
21222324252627
28      

past articles »

Click for San Francisco, California Forecast

San Francisco, USA

 

Refrigerator Madness solution (Facebook programming puzzle)

Refrigerator Madness is the second Facebook programming puzzle I have tried. The problem description is complicated. I won't try to repeat it here but to suggest you to refer to the original facebook page.

To solve this problem it is necessary to see through the smokescreen. Instead of thinking how much Red Bull a Facebook engineer likes to drink, it is easier to map it to a problem known as Two-Sided Matching. A model with intuitive meaning is a marriage matchup between a group of man and woman. Each man has his list of preferred woman and each woman has her list of preferred man. The marriage is considered stable if there are no two people of opposite sex who were not married to each other but would both prefer to be.

For the Refrigerator Madness problem just map the engineer from the upper 50th percentile to "man" and lower 50th percentile to "woman" (or vice versa). The matching condition is equivalent to the stable marriage criteria.

At this point the problem can be solved by applying the Gale-Shapley algorithm. Write the code and it's done!

2010.02.22 [] - comments

 

 

blog comments powered by Disqus

past articles »

 

BBC News

 

Afghanistan: 'We have won the war, America has lost', say Taliban (14 Apr 2021)

 

George Floyd death: Ex-officer Chauvin will not take the stand (15 Apr 2021)

 

US imposes sanctions on Russia over cyber-attacks (15 Apr 2021)

 

France urges citizens to leave Pakistan amid anti-French protests (15 Apr 2021)

 

Why are so many babies dying of Covid-19 in Brazil? (14 Apr 2021)

 

Torres Strait 8: Australian Islanders in landmark climate fight (14 Apr 2021)

 

Why Australia is in hysterics over a 'navy twerking' dance (15 Apr 2021)

 

William Amos: Canadian politician seen naked in work Zoom call (15 Apr 2021)

 

China 'can save .6 trillion by scrapping coal', report says (15 Apr 2021)

 

Texas students disciplined over 'slave trade game' (15 Apr 2021)

more »

 

SF Gate

 

It pays to search for top-quality auto shop (6 Feb 2021)

 

Fired Boeing CEO is now working with Bay Area tractor startup (14 Dec 2020)

 

PG&E bills to rise over per year on average to fund wildfire risk reduction (5 Dec 2020)

 

Nasdaq seeks more diversity on boards of companies listed on exchange (2 Dec 2020)

 

Elizabeth Holmes Prosecutors Say Texts Show Theranos Beset With Problems (24 Nov 2020)

 

Ship traffic, November 1 (30 Oct 2020)

more »


Site feed Updated: 2021-Apr-13 15:00