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.
With the
[[],[],[]]
it will throw an error whenret.append(array[n][x])
is triggered. So theif
statement is necessary.Note that range defaults to staring with 0, so you can just do
range(d)
. Also, try[0] * d
as a shortcut for producing an array full of zeros.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Yeah I figured that too.
This comment is hidden because it contains spoiler information about the solution
This is the first one I've seen that exits early (as soon as it can be determined that the odd one out is found). Other solutions run through the whole array one or more times and then decide which number did not fit. Although this is more verbose than those operations, it is the one I'd prefer to see in production code, especially if that code were called frequently.