Skip to content

Commit 10553c4

Browse files
authored
Implement flexible longest sliding window algorithm
1 parent 8b8af69 commit 10553c4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def sliding_longest_flexible(input):
2+
initialize window, ans
3+
for right in range(len(input)):
4+
append input[right] to window
5+
while invalid(window):
6+
remove input[left] from window
7+
left += 1
8+
ans = max(ans, window)
9+
return ans

0 commit comments

Comments
 (0)