TLE in Subarray Distinct Values

Revision en1, by case3, 2021-06-17 07:08:40

Hello everyone. This is a CSES problem: Subarray Distinct Values very simple and straightforward 2 pointer approach. My time complexity is O(n) visiting every array element almost twice. But I am getting TLE. Why.

My code: My Code on CSES

Tags #tle, #two pointers, #cses_searching

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English case3 2021-06-17 07:08:40 362 Initial revision (published)