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

 

Belarus election: Women form ‘solidarity chains’ to condemn crackdown (13 Aug 2020)

 

Joe Biden and Kamala Harris say Trump has left US 'in tatters' (13 Aug 2020)

 

US calls for shower rules to be eased after Trump hair complaints (13 Aug 2020)

 

Dolphin stampede wows whale watchers (12 Aug 2020)

 

Coronavirus: Spain's Galicia region bans smoking over Covid-19 risk (13 Aug 2020)

 

New Zealand coronavirus: 14 new Covid-19 cases reported (13 Aug 2020)

 

China launches 'Clean Plate' campaign against food waste (13 Aug 2020)

 

Mozambique battles IS militants for key port (13 Aug 2020)

 

UK 'must anticipate hostile states utilising pandemic' (12 Aug 2020)

 

CeeLo Green apologises to Cardi B and Megan Thee Stallion for 'salacious gesturing' remark (13 Aug 2020)

more »

 

SF Gate

 

Ship traffic, August 13 (12 Aug 2020)

 

Ship traffic, August 12 (11 Aug 2020)

 

Ship traffic, August 11 (10 Aug 2020)

 

Ship traffic, August 10 (7 Aug 2020)

 

Ship traffic, August 9 (7 Aug 2020)

 

Ship traffic, August 8 (7 Aug 2020)

more »


Site feed Updated: 2020-Aug-13 07:00