From 8a092568ca9024b6b3622dbec7611fca6b245d35 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Sahoo <79834663+ashish5kmax@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:52:09 +0530 Subject: [PATCH 01/11] Create Longest_Substring_Without_Repeating_Characters.cpp * I would like to contribute for sliding window algorithm and this one is one of the famous problem that is asked in interviews. * Thank you!!. --- ...Substring_Without_Repeating_Characters.cpp | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Longest_Substring_Without_Repeating_Characters.cpp diff --git a/Longest_Substring_Without_Repeating_Characters.cpp b/Longest_Substring_Without_Repeating_Characters.cpp new file mode 100644 index 00000000000..cb94cab6f9c --- /dev/null +++ b/Longest_Substring_Without_Repeating_Characters.cpp @@ -0,0 +1,55 @@ +/* Leetcode problem +Author : Ashish Kumar Sahoo +3. Longest_Substring_Without_Repeating_Characters +Intiuation : + Intuition is strightforward and simple, we track the frequencey and as we know we can't use string to track longest substring without repeating characters, as poping a char from front of string is not in O(1) which could be optimized by deque approch. +Approch : + 1) At first we initialize a unordered_map to track the frequncy and then. + 2) We initialize deque for pushing the characters and if temp > res we update our res deque to temp as we need longest substring here. + 3) And while loop is used to reduce the frequency from front doing i++ and removing charecters from temp deque as we no longer need them. + 4) return res.size() as we only need size not string. +Time Complexity : + O(N) +Space Complexity : + O(N) +I hope this helps to understand. +Thank you!! +*/ + +class Solution { +public: + int lengthOfLongestSubstring(string s) { + if(s.size()==1) return 1; + + unordered_mapm; + int n = s.length(); + + dequetemp; + dequeres; + int i,j; + for(i=0,j=0;i1) { + if(temp.size()>res.size()) { + res = temp; + } + + while(m[s[j]]>1) { + temp.pop_front(); + m[s[i]]--; + i++; + } + } + + temp.push_back(s[j]); + j++; + } + + if(temp.size()>res.size()) { + res = temp; + } + + return res.size(); + } +}; From 8985cabf58cb75fed3a7a949bc78749c11cf2523 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Sahoo <79834663+ashish5kmax@users.noreply.github.com> Date: Sat, 5 Oct 2024 14:08:08 +0530 Subject: [PATCH 02/11] Update and rename Longest_Substring_Without_Repeating_Characters.cpp to sliding-window/Longest_Substring_Without_Repeating_Characters.cpp * This is my contribution towards the sliding window algorithm/s and this is one of the famous problems. * Thank you. --- ...Substring_Without_Repeating_Characters.cpp | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) rename Longest_Substring_Without_Repeating_Characters.cpp => sliding-window/Longest_Substring_Without_Repeating_Characters.cpp (59%) diff --git a/Longest_Substring_Without_Repeating_Characters.cpp b/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp similarity index 59% rename from Longest_Substring_Without_Repeating_Characters.cpp rename to sliding-window/Longest_Substring_Without_Repeating_Characters.cpp index cb94cab6f9c..583e593de06 100644 --- a/Longest_Substring_Without_Repeating_Characters.cpp +++ b/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp @@ -1,29 +1,48 @@ /* Leetcode problem -Author : Ashish Kumar Sahoo +Author : @ashish5kmax (Ashish Kumar Sahoo) + 3. Longest_Substring_Without_Repeating_Characters +Problem link :- https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ + Intiuation : Intuition is strightforward and simple, we track the frequencey and as we know we can't use string to track longest substring without repeating characters, as poping a char from front of string is not in O(1) which could be optimized by deque approch. + Approch : 1) At first we initialize a unordered_map to track the frequncy and then. 2) We initialize deque for pushing the characters and if temp > res we update our res deque to temp as we need longest substring here. 3) And while loop is used to reduce the frequency from front doing i++ and removing charecters from temp deque as we no longer need them. 4) return res.size() as we only need size not string. + Time Complexity : O(N) Space Complexity : O(N) + +Examples:- + testcase1:- s = "abcabcbb", o/p = 3. + testcase2:- s = "bbbbb", o/p = 1. + testcase3:- s = "pwwkew", o/p = 3. + I hope this helps to understand. Thank you!! */ +// ----------------- Header files ---------------------------------- +#include +#include +#include + class Solution { public: int lengthOfLongestSubstring(string s) { + // if size of string is 1 then it will be the answer. if(s.size()==1) return 1; + // map used to store the characters frequency. unordered_mapm; int n = s.length(); + // dequeue to remove from back if repeating charcters are present. dequetemp; dequeres; int i,j; @@ -36,6 +55,7 @@ class Solution { } while(m[s[j]]>1) { + // as repeating charecter is present pop_front() is called. temp.pop_front(); m[s[i]]--; i++; @@ -53,3 +73,20 @@ class Solution { return res.size(); } }; + +//-------------------- Main function ------------------------------- +int main() { + // object of class Solution created for function call. + Solution soln; + + + // user inputted string. + string s; + cout<<"Enter the string : "<>s; + + // function call to get the ans of length of longest substring without repeating characters. + cout< Date: Sat, 5 Oct 2024 14:11:59 +0530 Subject: [PATCH 03/11] Update Longest_Substring_Without_Repeating_Characters.cpp * I would like to contribute towards the sliding window algorithm in which this is one of the famous problem asked in interviews. * Thank you. --- ...Substring_Without_Repeating_Characters.cpp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp b/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp index 583e593de06..1a635caf44f 100644 --- a/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp +++ b/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp @@ -1,31 +1,32 @@ -/* Leetcode problem -Author : @ashish5kmax (Ashish Kumar Sahoo) +/** Leetcode problem +* Author : @ashish5kmax (Ashish Kumar Sahoo) -3. Longest_Substring_Without_Repeating_Characters -Problem link :- https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ +* 3. Longest_Substring_Without_Repeating_Characters +* Problem link :- https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ -Intiuation : +* Intiuation : Intuition is strightforward and simple, we track the frequencey and as we know we can't use string to track longest substring without repeating characters, as poping a char from front of string is not in O(1) which could be optimized by deque approch. -Approch : +* Approch : 1) At first we initialize a unordered_map to track the frequncy and then. 2) We initialize deque for pushing the characters and if temp > res we update our res deque to temp as we need longest substring here. 3) And while loop is used to reduce the frequency from front doing i++ and removing charecters from temp deque as we no longer need them. 4) return res.size() as we only need size not string. -Time Complexity : +* Time Complexity : O(N) -Space Complexity : + +* Space Complexity : O(N) -Examples:- +* Examples:- testcase1:- s = "abcabcbb", o/p = 3. testcase2:- s = "bbbbb", o/p = 1. testcase3:- s = "pwwkew", o/p = 3. -I hope this helps to understand. -Thank you!! -*/ +* I hope this helps to understand. +* Thank you!! +**/ // ----------------- Header files ---------------------------------- #include From 67328faff3e558ced9e51c828796556a88f5f5b1 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Sahoo <79834663+ashish5kmax@users.noreply.github.com> Date: Sat, 5 Oct 2024 14:16:30 +0530 Subject: [PATCH 04/11] Update Longest_Substring_Without_Repeating_Characters.cpp * Updated certain changes in documentation, this is my contribution towards sliding window algorithm this is one of the famous interview problem. * Thank you. --- .../Longest_Substring_Without_Repeating_Characters.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp b/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp index 1a635caf44f..1579655135d 100644 --- a/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp +++ b/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp @@ -29,9 +29,9 @@ **/ // ----------------- Header files ---------------------------------- -#include -#include -#include +#include // for input and output read/write. +#include // to use it for character frequency. +#include // for push and pop operations at O(1) time. class Solution { public: From bbbff8af2d3380d2e419e1853b4663c510fb16ee Mon Sep 17 00:00:00 2001 From: Ashish Kumar Sahoo <79834663+ashish5kmax@users.noreply.github.com> Date: Sat, 5 Oct 2024 14:20:25 +0530 Subject: [PATCH 05/11] Update Longest_Substring_Without_Repeating_Characters.cpp * Well documented and tested code for sliding window algorithm. * Thank you. --- ...Longest_Substring_Without_Repeating_Characters.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp b/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp index 1579655135d..3afb4c9e72e 100644 --- a/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp +++ b/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp @@ -1,29 +1,23 @@ /** Leetcode problem * Author : @ashish5kmax (Ashish Kumar Sahoo) - * 3. Longest_Substring_Without_Repeating_Characters * Problem link :- https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ - * Intiuation : Intuition is strightforward and simple, we track the frequencey and as we know we can't use string to track longest substring without repeating characters, as poping a char from front of string is not in O(1) which could be optimized by deque approch. - * Approch : 1) At first we initialize a unordered_map to track the frequncy and then. 2) We initialize deque for pushing the characters and if temp > res we update our res deque to temp as we need longest substring here. 3) And while loop is used to reduce the frequency from front doing i++ and removing charecters from temp deque as we no longer need them. 4) return res.size() as we only need size not string. - * Time Complexity : O(N) * Space Complexity : O(N) - * Examples:- testcase1:- s = "abcabcbb", o/p = 3. testcase2:- s = "bbbbb", o/p = 1. testcase3:- s = "pwwkew", o/p = 3. - * I hope this helps to understand. * Thank you!! **/ @@ -32,6 +26,9 @@ #include // for input and output read/write. #include // to use it for character frequency. #include // for push and pop operations at O(1) time. +#include // for taking string as input + +using namespace std; // using the namspace standard to reduce the redundent usage of std:: when calling functions (basically reduicng an extra overhead). class Solution { public: @@ -80,7 +77,7 @@ int main() { // object of class Solution created for function call. Solution soln; - + // user inputted string. string s; cout<<"Enter the string : "< Date: Sat, 5 Oct 2024 19:26:29 +0530 Subject: [PATCH 06/11] Update and rename Longest_Substring_Without_Repeating_Characters.cpp to Longest_Substring_Without_Repeating_Characters.cpp * So,I did a small change I added the problem into the others section I think this works fine I guess. * I would be glad if this can be tagged as hackoctoberfest * Thank you. --- .../Longest_Substring_Without_Repeating_Characters.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) rename {sliding-window => others}/Longest_Substring_Without_Repeating_Characters.cpp (96%) diff --git a/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp b/others/Longest_Substring_Without_Repeating_Characters.cpp similarity index 96% rename from sliding-window/Longest_Substring_Without_Repeating_Characters.cpp rename to others/Longest_Substring_Without_Repeating_Characters.cpp index 3afb4c9e72e..98eb70c7513 100644 --- a/sliding-window/Longest_Substring_Without_Repeating_Characters.cpp +++ b/others/Longest_Substring_Without_Repeating_Characters.cpp @@ -1,6 +1,5 @@ -/** Leetcode problem -* Author : @ashish5kmax (Ashish Kumar Sahoo) -* 3. Longest_Substring_Without_Repeating_Characters +/** +* 3.Longest_Substring_Without_Repeating_Characters * Problem link :- https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ * Intiuation : Intuition is strightforward and simple, we track the frequencey and as we know we can't use string to track longest substring without repeating characters, as poping a char from front of string is not in O(1) which could be optimized by deque approch. From 77fd6432f6aeeea20a271fc5338961e5ab5336c1 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Sahoo <79834663+ashish5kmax@users.noreply.github.com> Date: Sat, 5 Oct 2024 19:43:46 +0530 Subject: [PATCH 07/11] Update and rename Longest_Substring_Without_Repeating_Characters.cpp to longest_substring_without_repeating_characters.cpp * I hope I have done the required changes. --- ...Substring_Without_Repeating_Characters.cpp | 89 -------------- ...substring_without_repeating_characters.cpp | 115 ++++++++++++++++++ 2 files changed, 115 insertions(+), 89 deletions(-) delete mode 100644 others/Longest_Substring_Without_Repeating_Characters.cpp create mode 100644 others/longest_substring_without_repeating_characters.cpp diff --git a/others/Longest_Substring_Without_Repeating_Characters.cpp b/others/Longest_Substring_Without_Repeating_Characters.cpp deleted file mode 100644 index 98eb70c7513..00000000000 --- a/others/Longest_Substring_Without_Repeating_Characters.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/** -* 3.Longest_Substring_Without_Repeating_Characters -* Problem link :- https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ -* Intiuation : - Intuition is strightforward and simple, we track the frequencey and as we know we can't use string to track longest substring without repeating characters, as poping a char from front of string is not in O(1) which could be optimized by deque approch. -* Approch : - 1) At first we initialize a unordered_map to track the frequncy and then. - 2) We initialize deque for pushing the characters and if temp > res we update our res deque to temp as we need longest substring here. - 3) And while loop is used to reduce the frequency from front doing i++ and removing charecters from temp deque as we no longer need them. - 4) return res.size() as we only need size not string. -* Time Complexity : - O(N) - -* Space Complexity : - O(N) -* Examples:- - testcase1:- s = "abcabcbb", o/p = 3. - testcase2:- s = "bbbbb", o/p = 1. - testcase3:- s = "pwwkew", o/p = 3. -* I hope this helps to understand. -* Thank you!! -**/ - -// ----------------- Header files ---------------------------------- -#include // for input and output read/write. -#include // to use it for character frequency. -#include // for push and pop operations at O(1) time. -#include // for taking string as input - -using namespace std; // using the namspace standard to reduce the redundent usage of std:: when calling functions (basically reduicng an extra overhead). - -class Solution { -public: - int lengthOfLongestSubstring(string s) { - // if size of string is 1 then it will be the answer. - if(s.size()==1) return 1; - - // map used to store the characters frequency. - unordered_mapm; - int n = s.length(); - - // dequeue to remove from back if repeating charcters are present. - dequetemp; - dequeres; - int i,j; - for(i=0,j=0;i1) { - if(temp.size()>res.size()) { - res = temp; - } - - while(m[s[j]]>1) { - // as repeating charecter is present pop_front() is called. - temp.pop_front(); - m[s[i]]--; - i++; - } - } - - temp.push_back(s[j]); - j++; - } - - if(temp.size()>res.size()) { - res = temp; - } - - return res.size(); - } -}; - -//-------------------- Main function ------------------------------- -int main() { - // object of class Solution created for function call. - Solution soln; - - - // user inputted string. - string s; - cout<<"Enter the string : "<>s; - - // function call to get the ans of length of longest substring without repeating characters. - cout< // for input and output read/write. +#include // to use it for character frequency. +#include // for push and pop operations at O(1) time. +#include // for taking string as input. + +using namespace std; // using the namespace standard to reduce redundant usage of std:: + +//------------------ Longest_Substring Class ------------------------------- +/** + * @class Solution + * @brief Class that solves the Longest Substring Without Repeating Characters problem. + */ +class Longest_Substring { +public: + /** + * @brief Function to find the length of the longest substring without repeating characters. + * @param s Input string. + * @returns Length of the longest substring. + */ + int lengthOfLongestSubstring(string s) { + // If the size of string is 1, then it will be the answer. + if (s.size() == 1) return 1; + + // Map used to store the character frequency. + unordered_map m; + int n = s.length(); + + // Deque to remove from back if repeating characters are present. + deque temp; + deque res; + int i, j; + + // Sliding window approach using two pointers. + for (i = 0, j = 0; i < n && j < n;) { + m[s[j]]++; + + // If repeating character found, update result and remove from the front. + if (m[s[j]] > 1) { + if (temp.size() > res.size()) { + res = temp; + } + + while (m[s[j]] > 1) { + temp.pop_front(); + m[s[i]]--; + i++; + } + } + + // Add the current character to the deque. + temp.push_back(s[j]); + j++; + } + + // Final check to update result. + if (temp.size() > res.size()) { + res = temp; + } + + return res.size(); // Return the length of the longest substring. + } +}; + +//-------------------- Main function ------------------------------- +/** + * @brief Main function. + * @returns 0 on successful execution. + */ +int main() { + // Create an object of the Solution class to call the function. + Longest_Substring s; + + // User inputted string. + string str; + cout << "Enter the string: " << endl; + cin >> str; + + // Function call to get the length of the longest substring without repeating characters. + cout << soln.lengthOfLongestSubstring(str) << endl; + + return 0; +} From e1bf9a0ba20c12656dfa6687bb2d6398b1dc515f Mon Sep 17 00:00:00 2001 From: Ashish Kumar Sahoo <79834663+ashish5kmax@users.noreply.github.com> Date: Sat, 5 Oct 2024 19:52:45 +0530 Subject: [PATCH 08/11] Update longest_substring_without_repeating_characters.cpp * Added specific edge cases and tests as void tests() and followed the guidelines. --- ...substring_without_repeating_characters.cpp | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/others/longest_substring_without_repeating_characters.cpp b/others/longest_substring_without_repeating_characters.cpp index 15185f5e7d6..bd92635d550 100644 --- a/others/longest_substring_without_repeating_characters.cpp +++ b/others/longest_substring_without_repeating_characters.cpp @@ -35,12 +35,13 @@ #include // to use it for character frequency. #include // for push and pop operations at O(1) time. #include // for taking string as input. +#include // for assert using namespace std; // using the namespace standard to reduce redundant usage of std:: //------------------ Longest_Substring Class ------------------------------- /** - * @class Solution + * @class Longest_Substring * @brief Class that solves the Longest Substring Without Repeating Characters problem. */ class Longest_Substring { @@ -48,7 +49,7 @@ class Longest_Substring { /** * @brief Function to find the length of the longest substring without repeating characters. * @param s Input string. - * @returns Length of the longest substring. + * @return Length of the longest substring. */ int lengthOfLongestSubstring(string s) { // If the size of string is 1, then it will be the answer. @@ -94,22 +95,24 @@ class Longest_Substring { } }; +// Testing function +static void tests() { + Longest_Substring soln; + assert(soln.lengthOfLongestSubstring("abcabcbb") == 3); + assert(soln.lengthOfLongestSubstring("bbbbb") == 1); + assert(soln.lengthOfLongestSubstring("pwwkew") == 3); + assert(soln.lengthOfLongestSubstring("") == 0); // Test case for empty string + assert(soln.lengthOfLongestSubstring("abcdef") == 6); // Test case for all unique characters + assert(soln.lengthOfLongestSubstring("a") == 1); // Single character + cout << "All test cases passed!" << endl; +} + //-------------------- Main function ------------------------------- /** * @brief Main function. - * @returns 0 on successful execution. + * @return 0 on successful execution. */ int main() { - // Create an object of the Solution class to call the function. - Longest_Substring s; - - // User inputted string. - string str; - cout << "Enter the string: " << endl; - cin >> str; - - // Function call to get the length of the longest substring without repeating characters. - cout << soln.lengthOfLongestSubstring(str) << endl; - + tests(); // run self-test implementations return 0; } From db4768d86c23e63f954c269ab56c230cbb4e4dcd Mon Sep 17 00:00:00 2001 From: Ashish Kumar Sahoo <79834663+ashish5kmax@users.noreply.github.com> Date: Sun, 6 Oct 2024 11:22:29 +0530 Subject: [PATCH 09/11] Update longest_substring_without_repeating_characters.cpp * I hope I have made the necessary changes required. * If there are any changes to make I can do that. * Thank you. --- ...substring_without_repeating_characters.cpp | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/others/longest_substring_without_repeating_characters.cpp b/others/longest_substring_without_repeating_characters.cpp index bd92635d550..5fb7b05f87a 100644 --- a/others/longest_substring_without_repeating_characters.cpp +++ b/others/longest_substring_without_repeating_characters.cpp @@ -5,10 +5,8 @@ * Problem link: https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ * * Intuition: - * The intuition is straightforward and simple. We track the frequency of characters. - * Since we can't use a string to track the longest substring without repeating characters - * efficiently (as removing a character from the front of a string isn't O(1)), - * we optimize the solution using a deque approach. + * 1) The intuition is straightforward and simple. We track the frequency of characters. + * 2) Since we can't use a string to track the longest substring without repeating characters efficiently (as removing a character from the front of a string isn't O(1)), we optimize the solution using a deque approach. * * Approach: * 1) Initialize an unordered_map to track the frequency of characters. @@ -21,25 +19,16 @@ * Time Complexity: O(N) * Space Complexity: O(N) * - * Examples: - * - testcase1: s = "abcabcbb", output = 3. - * - testcase2: s = "bbbbb", output = 1. - * - testcase3: s = "pwwkew", output = 3. - * * I hope this helps to understand. * Thank you! **/ -// ----------------- Header files ---------------------------------- #include // for input and output read/write. -#include // to use it for character frequency. +#include // for character frequency map. #include // for push and pop operations at O(1) time. #include // for taking string as input. -#include // for assert - -using namespace std; // using the namespace standard to reduce redundant usage of std:: +#include // for assert. -//------------------ Longest_Substring Class ------------------------------- /** * @class Longest_Substring * @brief Class that solves the Longest Substring Without Repeating Characters problem. @@ -51,17 +40,17 @@ class Longest_Substring { * @param s Input string. * @return Length of the longest substring. */ - int lengthOfLongestSubstring(string s) { + int lengthOfLongestSubstring(std::string s) { // If the size of string is 1, then it will be the answer. if (s.size() == 1) return 1; // Map used to store the character frequency. - unordered_map m; + std::unordered_map m; int n = s.length(); // Deque to remove from back if repeating characters are present. - deque temp; - deque res; + std::deque temp; + std::deque res; int i, j; // Sliding window approach using two pointers. @@ -95,7 +84,10 @@ class Longest_Substring { } }; -// Testing function +/** + * @brief Self-test implementations + * @returns void + */ static void tests() { Longest_Substring soln; assert(soln.lengthOfLongestSubstring("abcabcbb") == 3); @@ -104,10 +96,9 @@ static void tests() { assert(soln.lengthOfLongestSubstring("") == 0); // Test case for empty string assert(soln.lengthOfLongestSubstring("abcdef") == 6); // Test case for all unique characters assert(soln.lengthOfLongestSubstring("a") == 1); // Single character - cout << "All test cases passed!" << endl; + std::cout << "All test cases passed!" << std::endl; } -//-------------------- Main function ------------------------------- /** * @brief Main function. * @return 0 on successful execution. From b988cb57205ef69b48354eec7618096020cf4f46 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Sahoo <79834663+ashish5kmax@users.noreply.github.com> Date: Mon, 7 Oct 2024 19:55:51 +0530 Subject: [PATCH 10/11] Update longest_substring_without_repeating_characters.cpp * I have done the required changes for the include part. * Thank you. --- .../longest_substring_without_repeating_characters.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/others/longest_substring_without_repeating_characters.cpp b/others/longest_substring_without_repeating_characters.cpp index 5fb7b05f87a..8c33d58280d 100644 --- a/others/longest_substring_without_repeating_characters.cpp +++ b/others/longest_substring_without_repeating_characters.cpp @@ -23,11 +23,11 @@ * Thank you! **/ -#include // for input and output read/write. -#include // for character frequency map. -#include // for push and pop operations at O(1) time. -#include // for taking string as input. -#include // for assert. +#include // for IO Operations +#include // for std::unordered_map +#include // for std::deque +#include // for string class/string datatype which is taken as input +#include // for assert /** * @class Longest_Substring From 754ab2fd16ab119ac1136b384e4e62283165f8e5 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Sahoo <79834663+ashish5kmax@users.noreply.github.com> Date: Mon, 7 Oct 2024 20:00:02 +0530 Subject: [PATCH 11/11] Update longest_substring_without_repeating_characters.cpp added author name --- others/longest_substring_without_repeating_characters.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/others/longest_substring_without_repeating_characters.cpp b/others/longest_substring_without_repeating_characters.cpp index 8c33d58280d..3664ad71e7e 100644 --- a/others/longest_substring_without_repeating_characters.cpp +++ b/others/longest_substring_without_repeating_characters.cpp @@ -21,6 +21,7 @@ * * I hope this helps to understand. * Thank you! + * @author [Ashish Kumar Sahoo](github.com/ashish5kmax) **/ #include // for IO Operations