This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// time complexity: O(2n) = O(n) = linear; | |
// space complexity: O(1) contant; | |
const longestUniformSubstring = function(s) { | |
let length = s.length; | |
let letter = s[0]; | |
let startIndex = 0; | |
let endIndex = 0; | |
let resultIndex = 0; | |
let resultLength = 0; |