You are viewing a single comment's thread. Return to all comments →
def gamingArray(arr): # Write your code here turns = 0 def check_sort(check_arr): if check_arr == sorted(check_arr): return True return False while arr != []: if check_sort(arr): turns += len(arr) break else: i = arr.index(max(arr)) arr = arr[:i] turns += 1 if turns % 2 == 1: return "BOB" return "ANDY"
Seems like cookies are disabled on this browser, please enable them to open this website
Gaming Array
You are viewing a single comment's thread. Return to all comments →
def gamingArray(arr): # Write your code here turns = 0 def check_sort(check_arr): if check_arr == sorted(check_arr): return True return False while arr != []: if check_sort(arr): turns += len(arr) break else: i = arr.index(max(arr)) arr = arr[:i] turns += 1 if turns % 2 == 1: return "BOB" return "ANDY"