Created
August 8, 2022 03:54
-
-
Save fida10/3f8ef09d6b0557df624515e434dacbc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = "abccbaacz"; | |
lowestIndexOfSecond = len(s); | |
for i in range(0, len(s)): | |
currentVal = s[i]; | |
currentIndexOfSecond = len(s); | |
for j in range(i + 1, len(s)): | |
if (s[j] == currentVal): | |
currentIndexOfSecond = j; | |
break; | |
if (currentIndexOfSecond < lowestIndexOfSecond): | |
lowestIndexOfSecond = currentIndexOfSecond; | |
print(s[lowestIndexOfSecond]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment