Administrator
Published on 2026-01-25 / 0 Visits
0
0

Details in leetcode

or in python have short-circuit, including many or use together. if interpreter meet a true, it will stop calculating latter conditions

reversed() function in python won't actually reverse the structure, it just return an iterator pointing to the last element in the structure, and -1 after every next().

list.reversed reverse the struction and cover the origin

if we want to keep, use list(reverse(mylist))

slicing: list[start:end:step]

start is 0, end is size - 1 if not indicated.

the list is a circle

the positive direction is from start to end, so

if start is negative, went to the negative direction

list[::-1] is to generate a list from end to start


Comment