Solution to Dwarfs-Rafting by codility

19 Nov

Question: https://codility.com/demo/take-sample-test/dwarfs_rafting/

Question Name: Dwarfs-Rafting or DwarfsRafting

Need some simple mathematical knowledge. The code is unnecessarily long. A 2-d array is better to write much shorter code. However, I keep the long version for better readability.

8 Replies to “Solution to Dwarfs-Rafting by codility

  1. 100% in Python

  2. I am interested what is the technique you used to come up with the solution.
    I have taken data and structures class in college.
    I just do not seem to have the skills to think up a solution.
    Can you suggest some courses , or links that would help me figure out the algorithms like you do?

    • Open course Algorithms from Princeton University is a wonderful start point. Then practice, practice, and practice more.

  3. slightly modification to simplify the if else part

  4. Can someone explain what is wrong with my solution in C++ ?

    • Ok fixed it. gives 100%:

Leave a Reply

Your email address will not be published. Required fields are marked *

Please put your code into a <pre>YOUR CODE</pre> section. Thanks and Happy Coding!