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

 

Steve Bannon: Lawmakers vote to hold ex-Trump aide in contempt (20 Oct 2021)

 

Climate change: Fossil fuel production set to soar over next decade (20 Oct 2021)

 

North Korea claim test of new submarine-launched missile (20 Oct 2021)

 

Myanmar: Mass release of political prisoners (19 Oct 2021)

 

Squid Game helps Netflix subscriptions pick up (19 Oct 2021)

 

Rachel Levine: Transgender official sworn in as four-star admiral (20 Oct 2021)

 

Navy report blames crew for devastating fire on the Bonhomme Richard (19 Oct 2021)

 

Oleg Deripaska: FBI searches US homes linked to Russian oligarch (19 Oct 2021)

 

Hospital bosses urge return of England Covid rules (20 Oct 2021)

 

Michael Slater: Australian ex-cricketer arrested over alleged domestic violence (20 Oct 2021)

more »

 

SF Gate

 

13 Best Background Check Sites & Services: Search Criminal Records and Social Media Accounts Online (28 Jul 2021)

 

It pays to search for top-quality auto shop (6 Feb 2021)

 

Fired Boeing CEO is now working with Bay Area tractor startup (14 Dec 2020)

 

PG&E bills to rise over per year on average to fund wildfire risk reduction (5 Dec 2020)

 

Nasdaq seeks more diversity on boards of companies listed on exchange (2 Dec 2020)

 

Elizabeth Holmes Prosecutors Say Texts Show Theranos Beset With Problems (24 Nov 2020)

more »


Site feed Updated: 2021-Oct-15 12:00