Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save abidkhan484/aa23a089b8dbba5a3d9ac59b6ced215a to your computer and use it in GitHub Desktop.

Select an option

Save abidkhan484/aa23a089b8dbba5a3d9ac59b6ced215a to your computer and use it in GitHub Desktop.
leetcode problem
#!/usr/bin/python3
input_string = "abcabcbb"
starting_idx = 0; max_length = 0; length = 0
i,j=0,0
for i in range(len(input_string)):
for j in range(i-1, starting_idx-1, -1):
if (input_string[j] == input_string[i]):
starting_idx = j + 1
length = i - j
break
else:
length += 1
max_length = max(max_length, length)
print(max_length)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment