We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Gaming Array
Gaming Array
Sort by
recency
|
134 Discussions
|
Please Login in order to post a comment
Python3
python3 def gamingArray(arr): curr_max = 0 bob_turn = True for n in arr: if n > curr_max: curr_max = n bob_turn = not bob_turn return ['ANDY', 'BOB'][not bob_turn] `
The issue is that in every iteration you are finding the max value in array and then slicing, this is a n^2 solution thats why