Program 6 Solution


Category: Tag:



You will code the dynamic programming solutions for the coin row problem and robot coin problems presented in class and in the book.

Please read, or at least skim, if you haven’t: Segfault troubleshooting strategies

SSH Instructions:

In Putty/MobaXTerm/WinSCP/Bitvise/… or just plain SSH to​​on port 222

  • first character is a lowercase L

  • XY=01 | 02 | … | 36

If you’re off campus, you will need to have Duo 2 Factor Authentication setup.

From a non-lab Linux machine can ssh -p 222 <username>


Go to this URL: the e-mail selection… your GitHub and school e-mail addresses should be associated by now) Accept the Assignment

Follow the second link to the assignment.

Click on “Clone or download”

Copy the link

(if you’re remoting into the Linux labs, login and then switch to your ssh connection here) <navigate to wherever you want to work>

git clone <the url>

The assignment repositories are private, so you’ll need to login.

git config –global –editand edit the file (you probably did this already)

You can run the scoring function that builds and runs the tests for you and prints the score for you by running the following command (cdinto the cloned directory first):


You should see, “SCORE= 0” before you get any work done.

You can run the unit tests directly without using the score function (not necessary) with the following command, also from the downloaded directory.

cd program-_-<username> (written generically)

mkdir build && cd build

cmake ..



Do amake clean if it seems to be acting “oddly”.

Read the code… you just have to implement two functions but you basically get half credit if you get to correctly output the optimal valueand the other half for outputting the optimal solution. Note that there is Coin Row test that follows the example in the slide.

Note that there are other tests that are letting you see the times for the recursive solutions (generally done twice). Your times should be around half of those. (may vary ~20%… variations in problem size are significant for recursive solution efficiency).

Committing (backup and submission)

When I’m done or want to backup (git is for version control) I just git add .

git commit -m “<some message>” // “final submission” makes sense if you’re done git push origin master

We will grade the last submission up to the deadline (the very last submission until we won’t accept it anymore, possibly with a late penalty).

No need to submit code to dropbox.