Problem:
Please find the problem here.
Solution:
This solution is based on dynamic programming, in particular, patience sorting. The code should explain in details how its work.
Code:
Copyright (c) 2024 Andrew Au