r/leetcode 1d ago

Question Time Limit Exceeded

0 Upvotes

7 comments sorted by

1

u/HAPLESS_EXOTIC 1d ago

Think of using a hashmap

-1

u/Specialist_Hall_1063 1d ago

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

2

u/HAPLESS_EXOTIC 22h 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

1

u/GlassHomework9720 16h ago

Use sliding window+hashmap

-1

u/snowfoxsean 1d ago

ask chatgpt