When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

v-O_O-v's blog

By v-O_O-v, history, 5 years ago, In English

I have solved 285C - Building Permutation using a greedy approach i.e sort all the values and then count the number of moves to make first element 1, the next to 2 and so on... But how can we come to the conclusion that this is always optimal and produces the minimum number of moves?

  • Vote: I like it
  • 0
  • Vote: I do not like it