Skip to content

Commit 0886724

Browse files
committed
Add Slower alternative for Longest Substring
1 parent 2a97aa8 commit 0886724

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

longest_substring.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ func lengthOfLongestSubstring(s string) int {
1212
for _, v := range s {
1313
vStr := string(v)
1414

15+
// Slower
16+
// split := strings.Split(current, vStr)
17+
// if len(split) > 1 {
18+
// fmt.Printf("\nFound %s, Resetting %s to: %s", vStr, current, split[1])
19+
// current = split[1]
20+
// }
21+
1522
// Faster
1623
oldIndex := strings.Index(current, vStr)
1724
if oldIndex > -1 {

0 commit comments

Comments
 (0)