redditgifts Python Programmer task 2012 | part 1: A first look

Reddit is hiring! Unfortunately I’m not sure I’m qualified, since I’m not familiar with how the Web works, from a behind the scenes stand point, but I’m interested in at least trying to tackle their dev challenge, which is to create an app that matches redditors together based on some preference for shipping internationally or not, and then create a list with a unique ID, their country, and the shipping preference. Definitely seems doable.

They’ve set some very clear goals, as well as some great guidelines as to what response they want, which makes our life a lot easier. After the jump is the entire job spec, for later use, or as a backup.

Some additional notes: Full country names would be beneficial, as well as explaining how the uID was created. Basically, ship internationally to those who want it, and make sure that people don’t get a gift from the same person they sent it to.
When participants sign up for a gift exchange on redditgifts they specify two properties that are used within our matching process:

  1. Shipping Country (string)
  2. Shipping Preferences – whether or not they are willing to ship internationally (boolean)

Your program needs to find the best possible way to match participants such that:

  • Whenever possible, the participants shipping preferences are adhered to.
  • Whenever possible, participants who send a gift to a country other than their own are more likely to receive a gift from a country other than their own. Participants who indicate that they are willing to ship internationally typically wish to receive internationally, so amongst those who are willing to ship internationally, maximize the number of people who receive a gift from a country other than their own.
  • Whenever possible, participants should not receive a gift from the same person they send a gift to.
  • Every participant must be matched.
  • The matching process should runs efficiently, meaning the execution time is short.


Your program should take 1 parameter as input, a list (array) where each item is a list (array) that represents a participant and has these three elements:

  1. unique id of participant (integer)
  2. shipping country of participant (string)
  3. willing to ship internationally (boolean)

Example: [[234, ‘US’, True], [235, ‘US’, False],]

Your program should return a list (array) where each element is a 2 item list (array) containing:

  • Unique id of participant giving the gift
  • Unique id of participant receiving the gift
  • Example: [[234, 235], [235, 234],]

Leave a Reply

Your email address will not be published.