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

 

UK political storm over seized tanker (21 Jul 2019)

 

Hong Kong protests: Police fire tear gas at demonstrators (21 Jul 2019)

 

Ukraine election: President Zelensky's party triumphs - exit polls (21 Jul 2019)

 

Portugal wildfires: Huge blazes force evacuations (21 Jul 2019)

 

South Africa's Cyril President Ramaphosa hits back in corruption row (21 Jul 2019)

 

Ocasio-Cortez: Trump is 'putting millions of Americans in danger' (21 Jul 2019)

 

Golf: Lowry claims first major with Open win (21 Jul 2019)

 

Comic Con: Marvel reveals Blade, Shang Chi and female Thor (21 Jul 2019)

 

Britain's chancellor to quit if Johnson becomes PM (21 Jul 2019)

 

SOS Méditerranée resumes Mediterranean migrant rescues (21 Jul 2019)

more »

 

SF Gate

 

Google Glass lives on as a device to teach autistic children (21 Jul 2019)

 

The best-sounding true wireless headphones (21 Jul 2019)

 

‘Dumbfake’ videos may be worse than deepfakes? (20 Jul 2019)

 

Despite high hopes, self-driving cars are ‘way in the future’ (20 Jul 2019)

 

Dream of retiring abroad? The reality: Medicare doesn’t travel well (19 Jul 2019)

 

Trump says he may intervene in huge Pentagon cloud contract (19 Jul 2019)

more »


Site feed Updated: 2019-Jul-21 12:00