You are viewing a single comment's thread. Return to all comments →
Far more elegant and simple python3 solution.
def solve(a0, a1, a2, b0, b1, b2): arr = [a0, a1, a2, b0, b1, b2] return compare(arr, 0, len(arr) - 1, [0, 0]) def compare(a, start, stop, result): if start >= stop: return str(result[0]) + str(result[1]) elif a[start] > a[stop]: result[0] += 1 elif a[start] < a[stop]: result[1] += 1 return compare(a, start + 1, stop - 1, result)
Compare the Triplets
You are viewing a single comment's thread. Return to all comments →
Far more elegant and simple python3 solution.