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

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 12

  • @AlgorithmsMadeEasy
    @AlgorithmsMadeEasy  3 года назад +1

    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:
    ✅✅✅[ Tree Data Structure ] : ruclips.net/p/PLJtzaiEpVo2zx-rCqLMmcFEpZw1UpGWls
    ✅✅✅[ Graphs Data Structure ] : ruclips.net/p/PLJtzaiEpVo2xg89cZzZCHqX03a1Vb6w7C
    ✅✅✅[ December Leetcoding Challenge ] : ruclips.net/p/PLJtzaiEpVo2xo8OdPZxrpybGR8FmzZpCA
    ✅✅✅[ November Leetcoding Challenge ] : ruclips.net/p/PLJtzaiEpVo2yMYz5RPH6pfB0wNnwWsK7e
    ✅✅✅[ August Leetcoding Challenge ] : ruclips.net/p/PLJtzaiEpVo2xu4h0gYQzvOMboclK_pZMe
    ✅✅✅July Leetcoding challenges: ruclips.net/p/PLJtzaiEpVo2wrUwkvexbC-vbUqVIy7qC-
    ✅✅✅June Leetcoding challenges: ruclips.net/p/PLJtzaiEpVo2xIfpptnCvUtKrUcod2zAKG
    ✅✅✅May Leetcoding challenges: ruclips.net/p/PLJtzaiEpVo2wRmUCq96zsUwOVD6p66K9e
    ✅✅✅Cracking the Coding Interview - Unique String: ruclips.net/p/PLJtzaiEpVo2xXf4LZb3y_BopOnLC1L4mE
    Struggling in a question??
    Leave in a comment and we will make a video!!!🙂🙂🙂

  • @crunchworking3601
    @crunchworking3601 Год назад +1

    it was quite helpful

  • @thugken
    @thugken Год назад

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

  • @atularya7124
    @atularya7124 3 года назад +4

    really hard to understand please provide more explanation

    • @EntEduRealm
      @EntEduRealm 2 года назад

      ruclips.net/video/vHZjMkrSc2M/видео.html

  • @cricsinghvlogz
    @cricsinghvlogz 3 года назад +1

    nice

  • @Progresser436
    @Progresser436 3 года назад +2

    Ek no.🙂

  • @pallavithukral3469
    @pallavithukral3469 3 года назад +1

    Please code in c++ language instead of Java

  • @lrchoudhary6875
    @lrchoudhary6875 2 месяца назад

    C++ Code :
    class Solution {
    public:
    // Sliding Window
    // TC : O(n)
    // SC :O(min(m,n)); m - length of charset
    int lengthOfLongestSubstring(string s) {
    int n = s.size();
    int maxLen = 0;
    // Store last seen index of each character
    unordered_map 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;
    }
    };