def listBeautifier(a): res = a[:] while res and res[0] != res[-1]: b, *res, c = res return res
Previous
def listBeautifier(a): res = a[:] while res and res[0] != res[-1]: b, *res, c = res return res
def mexFunction(s, upperBound): found = -1 for i in range(upperBound): if not i in s: found = i break else: found = upperBound return found
def baseConversion(n, x): return hex(sum((int(n[i]) if n[i] <= '9' else ord(n[i]) - ord('a') + 10) * x ** (len(n) - 1 - i) for i in range(len(n))))[2:]
def simpleSort(arr): n = len(arr) for i in range(n): j = 0 stop = n - i while j < stop - 1: if arr[j] > arr[j + 1]: arr[j + 1], arr[j] = arr[j], arr[j + 1] j += 1 return arr