Quick simplification fix

This commit is contained in:
TiagoRG 2023-02-03 17:32:28 +00:00
parent 871926bd71
commit 9db98acede
Signed by untrusted user who does not match committer: TiagoRG
GPG Key ID: DFCD48E3F420DB42
1 changed files with 1 additions and 5 deletions

View File

@ -5,12 +5,8 @@
# os primeiros n elementos igualam os últimos n elementos (sem sobreposição). # os primeiros n elementos igualam os últimos n elementos (sem sobreposição).
def firstEqualLast(lst): def firstEqualLast(lst):
if len(lst) <= 1:
return 0
n = 0 n = 0
for i in range(1, len(lst)//2+1): for i in range(1, len(lst)//2+1):
if lst[:i] == lst[len(lst)-i:]: if lst[:i] == lst[-i:]:
n = i n = i
return n return n