Skip navigation
Programming exercise

Programming exercise

Embedding problems in restaurant orders

With apologies to xkcd, please provide a solution to the following programming exercise:

You will be given a data file [sample data file]. The first line of the data file will have a target price. The following lines contain a menu of dishes.

Write a program to read in the data file and find any combination of dishes that add up exactly to the target price specified on the first line of the data file. If there is no solution, your program should specify that there is no combination of dishes that will be equal in cost to the target price.

Your program will be tested on multiple data sets so please provide syntax on how to invoke your program with the correct data file. You may use any programming language of your choice.

(312) 563-1830
info@tablexi.com
123 N. Jefferson St., Suite 4F, Chicago, IL 60661