111 - History Grading

This is a very simple dynamic programming problem with very puzzling description.

Basically “ranking” is just index. Given an input string:

3 1 2 4 9 5 10 6 8 7

It means the first event is at index 3, the second event is at index 1, etc. Let us denote events with letters to avoid confusion.

Event: a b c d e f g h i j
Index: 3 1 2 4 9 5 10 6 8 7

So the ordering of events is: b c a d f h j i e g.

Here is a reference solution.

Creative Commons License
This blog by Che-Liang Chiou is licensed under a Creative Commons Attribution 4.0 International License.