Topic: Stack Problem / Level: advanced

Problem: Design a stack-based algorithm to solve the problem of finding the longest increasing subsequence with exactly k distinct elements.

Run the code to see the output here...