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

 

Fourth of July: Trump vows to defeat 'radical left' in Independence Day speech (05 Jul 2020)

 

Hong Kong security law: Pro-democracy books pulled from libraries (05 Jul 2020)

 

Vogue Portugal defends controversial mental health cover (05 Jul 2020)

 

Kanye West again says he will run for president (05 Jul 2020)

 

Underwater cave in Mexico reveals ancient Mayan secrets (05 Jul 2020)

 

Hachalu Hundessa: Ethiopia singer's death unrest killed 166 (05 Jul 2020)

 

Coronavirus: Mexico's death toll passes 30,000 (05 Jul 2020)

 

Japan flooding: Fourteen dead in flooded care home (05 Jul 2020)

 

Drunk people will not keep apart, UK police warn (05 Jul 2020)

 

Dominican Republic votes in election postponed over virus (05 Jul 2020)

more »

 

SF Gate

 

Ship traffic, July 6 (2 Jul 2020)

 

Ship traffic, July 5 (2 Jul 2020)

 

Ship traffic, July 4 (2 Jul 2020)

 

Ship traffic, July 3 (2 Jul 2020)

 

Ship traffic, July 2 (1 Jul 2020)

 

Ship traffic, July 1 (30 Jun 2020)

more »


Site feed Updated: 2020-Jul-05 09:00