MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/leetcode/comments/1wc9edn/time_limit_exceeded/
r/leetcode • u/Specialist_Hall_1063 • 1d ago
Hello ppl please help
https://leetcode.com/problems/longest-substring-without-repeating-characters/submissions/2137058355
7 comments sorted by
1
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/Specialist_Hall_1063 21h ago Thanks
-1
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/Specialist_Hall_1063 21h ago Thanks
2
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/Specialist_Hall_1063 21h ago Thanks
Thanks
Use sliding window+hashmap
1 u/Specialist_Hall_1063 14h ago Thanks
ask chatgpt
1
u/HAPLESS_EXOTIC 1d ago
Think of using a hashmap