33
Kurush Kurushich
Last seen 6 days ago
Member for 11 years, 2 months, 12 days
Difficulty Normal
There is an error in your solution. You can consider the following additional test case: "assert river_crossing(0, 4, 1, 2) == 7, 'many goats'".
More
I didn't compare this solution with others. But alpha-beta pruning wasn't fast enough for this task. So speed optimization was required for this task. That's why I have chosen the speedy category for my solution.
More
Good approach. But it can be significantly reduced to " return len(set(elements)) <= 1" or " return len(set(elements)) < 2".
More
I have used the same idea as you. Another approach to make a one-liner is to use slices: return val[::-1]
More
Very subtle approach! Nice job!
More
I used the same one-liner but inside the function.
More