Constructive Algorithms

Codeforces likes a lot of those problems.

Here are some super hard that I found that I did:

  • Output the -th permutation of size with maximum sum, where the sum is defined as
  • This video has very good explanation https://www.youtube.com/watch?v=6K027clptCc
  • basically, the number of subarrays that includes is given by (1-indexed)
  • Once you figure out that logic and draw out the numbers, then you see that its always increasing