shivanshugarg12800 / Algo_GT

This is the Master Repository for all the different algorithms in the world of DSA, be it in any language C++, Java, Python etc.....
12 stars 37 forks source link

Longest Substring Without Repeating Characters #64

Closed kumarshobhit closed 2 years ago

kumarshobhit commented 2 years ago

Is your feature making a change to an existing problem/algorithm yes

If you are making changes, please describe the type of change in brief else NA Given a string s, find the length of the longest substring without repeating characters. This problem will be added in java language.

Describe in brief about what new problem/algorithm addition the idea is, keep a hashmap that stores the characters in a string as keys and their positions as values, and keep two pointers that define the max substring. move the right pointer to scan through the string, and meanwhile update the hashmap. If the character is already in the hashmap, then move the left pointer to the right of the same character last found. Note that the two pointers can only move forward.

shivanshugarg12800 commented 2 years ago

You can work on this issue @kumarshobhit