We're hiring!

We're actively seeking designers and developers for all three of our locations.

Use Clojure to Move Drugs – A Programming Challenge

You are a drug trafficker. Every day you meet with a different nice old lady (the mule) and find out how much weight she can carry in her handbag. You then meet with your supplier who has packed various drugs into a myriad of collectible porcelain dolls. Once packed with drugs, each of the precious dolls has a unique combination of weight and street value. Sometimes your supplier has more dolls than grandma can carry, though space in her handbag is never an issue. Your job is to choose which dolls the nice old lady will carry, maximizing street value, while not going over her weight restriction.

Write a program in Clojure that chooses the optimal set of drug-packed porcelain dolls from a set where each has a unique weight and value combination, while staying within a given weight restriction, W, that maximizes the street value of drugs delivered by the grandma, including a set of executable high-level tests for your solution.

Fork this repo on Github to share your solution!

Micah Alles (27 Posts)

I’ve been developing software at Atomic Object since May 2002 – starting as an intern, graduating to full-time employment, and eventually becoming a part owner in 2009. Over the years I’ve lead and been a team member on multiple mobile, web, and desktop projects for clients ranging from startups to the Fortune 500. I love being part of a company with such a strong culture of moving forward and increasing our collective average of skill and quality, in particular, through my favorite two of our five value mantras: Give a Shit, and Teach and Learn.

This entry was posted in Functional Programming and tagged . Bookmark the permalink. Both comments and trackbacks are currently closed.

2 Comments

  1. Posted May 31, 2011 at 1:54 pm

    This the bounded variant of the Knapsack problem.

    Spoilers here. (Although there isn’t a Clojure solution there yet, there is a PicoLisp solution which is probably trivial to translate)

  2. Posted June 1, 2011 at 4:32 am

    Next Weeks Challenge: Write an undercover watcher program in Erlang to optimise surveillance time of these dodgy characters

One Trackback

  1. By How Do You Describe Yourself? | Atomic Spin on July 13, 2012 at 7:01 am

    [...] a range of different opportunities to sell themselves to us: resumès, writing samples, portfolios, programming challenges, interviews, [...]