leetcode打不开-leetcode:leetcode

时间:2021-06-30 02:15:42
【文件属性】:
文件名称:leetcode打不开-leetcode:leetcode
文件大小:328KB
文件格式:ZIP
更新时间:2021-06-30 02:15:42
系统开源 leetcode打不开1. 二和 1.建立哈希表(key为输入数组的值,value为输入数组的索引) 2.遍历输入数组,使用哈希表查找第二个数字 3. 无重复字符的最长子串 1.使用headIndex和endIndex表示当前子串2.使用哈希表curSubstr存储当前子串中的所有字符3. Increase endIndex by 1 until the end if s[endIndex] is in the hash table duplicatedCharIndex = curSubstr[s[endIndex]] remove all the elements from headIndex to duplicatedCharIndex in curSubstr move headIndex to the right of the duplicated character (headIndex = duplicatedCharIndex + 1) else add [s[endIndex]]endIndex to curSubstr if length of the curren

网友评论