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

 

Chicago hospital shooting: Medical staff and policeman among four dead (20 Nov 2018)

 

Airbnb removes Israeli West Bank settlement listings (19 Nov 2018)

 

'Ditch the witch': Julia Gillard shocked by 'vile' abuse while Australian PM (20 Nov 2018)

 

Jim Acosta row: White House restores CNN reporter's pass (19 Nov 2018)

 

'Drunk' Canadian curlers kicked out of tournament final (19 Nov 2018)

 

Transgender women in India: 'This is how we survive' (20 Nov 2018)

 

Huge waves hit Tenerife in Spain's Canary Islands (19 Nov 2018)

 

Sophia Florsch: 'No fear of paralysis' for F3 driver after surgery (19 Nov 2018)

 

UK PM seeks business backing for Brexit plan (19 Nov 2018)

 

Thousands flee as Guatemala's Fuego volcano erupts (19 Nov 2018)

more »

 

SF Gate

 

Ship traffic, November 20 (19 Nov 2018)

 

Why the best shopping holiday for travelers may not be Black Friday (18 Nov 2018)

 

Bay Area stores that will be closed on Thanksgiving (18 Nov 2018)

 

‘No morals’: Advertisers react to Facebook report (18 Nov 2018)

 

Ship traffic, November 19 (18 Nov 2018)

 

Delay, deny and deflect: How Facebook’s leaders fought through crisis (17 Nov 2018)

more »


Site feed Updated: 2018-Nov-19 21:00