• + 1 comment

    hi

    your solution is good but it can be optimize further. here is the trick to solve this problem in O(K).

    https://youtu.be/bc7cxeDy308