ARMYOFME Video Solution

Sorry for the delay, here it is:


Commented code: https://www.codechef.com/viewsolution/28958507
“Queries for number of distinct elements in a subarray”:
https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/
Stack algorithm for “next greater element”:
https://www.geeksforgeeks.org/next-greater-element/
Persistent segment tree:
https://www.geeksforgeeks.org/persistent-segment-tree-set-1-introduction/
Comments, questions, requests, criticism, are all welcome!
12 Likes