can you you explain how it take o(n3) complexity
because my program take (nlogn) complexity to check dublicate
then overall complexity is (n^3logn)
Interview Problem - Maximum Length Unique Character Substring | Sliding Window Search
Hello @khemchandrs
What you can do to check duplicates is maintain an array say count[26] = {0}
//Here count[0] denotes count of ‘A’ count[1] denotes of count ‘B’…
Now for each element in a sequence from i to j
Increment the value of the “count” array corresponding to the element
if a character is encountered more than 1 time then the value of count[k] will be greater than 1 and then you know that the sequence is invalid.
It is O(n) so total will be O(n^3)
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.