Longest Substring Without Repeating Characters | Live Coding with Explanation | Leetcode - 3

preview_player
Показать описание
Detailed explanation for Longest Substring Without Repeating Character Leetcode 3

To support us you can donate

Check out our other popular playlists:

If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.

#coding #leetcode #programminglife #programmingisfun #programmer #tech #software #codinglife #leetcode
Рекомендации по теме
Комментарии
Автор

We hope you all are enjoying our videos!!! Don't forget to leave a comment!!! Please like the video to support us!!!

Questions you might like:

Struggling in a question??

Leave in a comment and we will make a video!!!🙂🙂🙂

AlgorithmsMadeEasy
Автор

really hard to understand please provide more explanation

atularya
Автор

"gbcjkancb" in this case, the output shows "jkanc" not "jkancb" because 'b' is already in the map. don't you need to update map?

Infp_recovery_room
Автор

C++ Code :


class Solution {
public:
// Sliding Window
// TC : O(n)
// SC :O(min(m, n)); m - length of charset
int s) {
int n = s.size();
int maxLen = 0;
// Store last seen index of each character
unordered_map<char, int> charIndex;

int start = 0;
for (int end = 0; end < n; end++) {
if (charIndex.find(s[end]) != charIndex.end()) {
start = charIndex[s[end]];
maxLen = max(maxLen, end - start);
}
charIndex[s[end]] = end;
maxLen = max(maxLen, end - start);
}

return maxLen;
}
};

lrchoudhary
Автор

Please code in c++ language instead of Java

pallavithukral