Refactoring

This commit is contained in:
akp 2020-12-15 20:10:47 +00:00
parent 97e79c4fce
commit 1962d90d22
No known key found for this signature in database
GPG key ID: D3E7EAA31B39637E
2 changed files with 4 additions and 4 deletions

View file

@ -74,4 +74,4 @@ func zfill(instr string, n int) string {
instr = "0" + instr
}
return instr
}
}

View file

@ -13,11 +13,11 @@ def find_value_n(instr:str, threshold:int) -> Tuple[int, List[int]]:
c = len(inp) - 1
previous_number = inp[c]
occurences = indexes.get(previous_number, None)
previous_occurance_index = indexes.get(previous_number, None)
new_number = 0
if occurences is not None:
new_number = c - occurences
if previous_occurance_index is not None:
new_number = c - previous_occurance_index
indexes[previous_number] = c