Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anupvarghese/skiing
https://github.com/anupvarghese/skiing
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/anupvarghese/skiing
- Owner: anupvarghese
- Created: 2015-06-05T02:45:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-05T02:47:18.000Z (over 9 years ago)
- Last Synced: 2023-08-02T07:13:03.752Z (over 1 year ago)
- Language: C#
- Size: 1.76 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Skiing Problem
=============In digital form the map looks like the number grid below.
4 4
4 8 7 3
2 5 9 3
6 3 2 5
4 4 1 6The first line (4 4) indicates that this is a 4x4 map. Each number represents the elevation of that area of the mountain. From each area (i.e. box) in the grid you can go north, south, east, west - but only if the elevation of the area you are going into is less than the one you are in. I.e. you can only ski downhill. You can start anywhere on the map and you are looking for a starting point with the longest possible path down as measured by the number of boxes you visit. And if there are several paths down of the same length, you want to take the one with the steepest vertical drop, i.e. the largest difference between your starting elevation and your ending elevation.
On this particular map the longest path down is of length=5 and it’s highlighted in bold below: 9-5-3-2-1.
4 4
4 8 7 3
2 5 9 3
6 3 2 5
4 4 1 6There is another path that is also length five: 8-5-3-2-1. However the tie is broken by the first path being steeper, dropping from 9 to 1, a drop of 8, rather than just 8 to 1, a drop of 7.