Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
a
Spoiler flag plz.
hint: don't use max(list), it's O(n) time complexity, and total will be
$O(n^2)$
, time out.and list.index(item) is
$O(n)$
, too.This comment is hidden because it contains spoiler information about the solution
Teshan_ss, please mark your posts as having spoiler content when posting code like that.
In binary,
0 = False/OFF
and1 = True/ON
. In your code, this line to be exact,if item is 0:
, will also countFalse
in.Using your code, an array of
[False, 0]
willreturn
an array of[0, 0]
. Hence, the extra zero.Your result returned an extra
0
at the end of the array.