add new solutions

This commit is contained in:
kanna5 2026-01-05 16:48:03 +09:00
parent d798d5e8c9
commit 886b5e0a8e
Signed by: kkyy
GPG key ID: 06332F3965E9B0CF
34 changed files with 1164 additions and 0 deletions

View file

@ -0,0 +1,20 @@
package q3
func lengthOfLongestSubstring(s string) int {
seen := make([]bool, 256)
maxLen := 0
l := 0
for r := range len(s) {
c := s[r]
for seen[c] {
seen[s[l]] = false
l++
}
seen[c] = true
maxLen = max(maxLen, r-l+1)
}
return maxLen
}
var _ = lengthOfLongestSubstring