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

 

Saudi Arabia vows to respond to oil attacks with 'necessary measures' (21 Sep 2019)

 

Saudi Arabia oil attacks: A look at the damage (21 Sep 2019)

 

Battle of Arnhem: Mass parachute drop marks WW2 assault (21 Sep 2019)

 

Emmy Awards 2019: Countdown to ceremony begins (21 Sep 2019)

 

Meteor lights up parts of Australian sky (21 Sep 2019)

 

Man drowns during underwater marriage proposal (21 Sep 2019)

 

Taylor Swift cancels concert amid animal rights criticism (21 Sep 2019)

 

Iranian hostage freed by Somali pirates after four years (21 Sep 2019)

 

Jennifer Lopez revives dress behind the invention of Google Images (21 Sep 2019)

 

Paris climate march halted amid clashes between activists and police (21 Sep 2019)

more »

 

SF Gate

 

Buick name erased from Buicks (21 Sep 2019)

 

How to navigate iPhone’s new privacy features (21 Sep 2019)

 

Facebook suspends thousands of apps over privacy concerns (20 Sep 2019)

 

Huawei emerges as stronger tech competitor (20 Sep 2019)

 

GM strike starts to pinch suppliers, Canada plants (20 Sep 2019)

 

Ship traffic, September 23 (20 Sep 2019)

more »


Site feed Updated: 2019-Sep-21 18:00