Javascript Solution using Sliding Window in O(n) time (w/ explanation)
Explanation\n\nThe main method used for this problem is the sliding window technique. The sliding window is essentially 2 pointers that will help to keep track 
## Explanation\n\nThe main method used for this problem is the **sliding window** technique. The sliding window is essentially 2 pointers that will help to keep track the start and end of a substring. In this solution, this window will always contain a substring with no duplicate characters.\n\nHere are the brief steps of my solution:\n\n1. We initialize the variables maxLength, which keeps track of the current longest length of any substring in the string, and left, which is the start of the substring currently being tracked. A set is also initialised to keep track of the elements in a substring. Since there are no duplicate characters in the substring (unique), a set will be a perfect tool to keep track of duplicates.\n\n2. We iterate through this loop using a right pointer. As this right pointer moves, we first check if the char at the right pointer is a duplicate of any previous characters in the substring by cross checking with the set.\n\n3. If the set already has the character, the set will continuously remove the leftmost char s[left] while also shifting the left pointer to the right. This will shrink the window size until there are no more duplicates characters.\n\n4. Once it is ensured that there are no duplicate characters, it will add the right most char s[right] to the set and update maxLength if this new substring is longer than a previous substring.\n\n## Performance\n\nThe time complexity of this solution is linear, **O(n)**, since we solved the problem by having to pass through the string only once.\n\nHere are the details of my submission:\nRuntime: 96 ms, faster than 89.62% \nMemory Usage: 43.3 MB, less than 74.80% \n\n## Code\n\n```\nvar lengthOfLongestSubstring = function(s) {\n    var maxLength = 0\n    var left = 0\n    var charSet = new Set()\n    \n    for (var right = 0; right < s.length; right++){\n        while (charSet.has(s[right])){\n            charSet.delete(s[left])\n            left += 1\n        }\n        charSet.add(s[right])\n        maxLength = Math.max(maxLength, right - left + 1)\n    }\n    \n    return maxLength\n};\n```\n\nI hope this helps! Do let me know if there are any lapses in my explanation and/or if my solution can be improved in any way :)
['Sliding Window', 'Ordered Set', 'JavaScript']