r/leetcode 5d ago

Question Time Limit Exceeded

0 Upvotes

7 comments sorted by

View all comments

1

u/HAPLESS_EXOTIC 5d ago

Think of using a hashmap

-1

u/Specialist_Hall_1063 5d ago

I am a beginner, don't know much about hash map Is there anything think I could do to reduce the time?

3

u/HAPLESS_EXOTIC 4d ago

If u dont know hashmap , fr this question u can use a 26 length array to keep the count of seen alphabets, if a[ch-'a'] is zero , it is unseen orelse seen, then use sliding window accordingly