We have only one input. If our number is one, it means that it is head of the coin, and in other situation it means tail of the coin. So you need count how many coins we need to flip to get all heads.
Example
x = [1 0 0 1 0]
answer is : 3
Because there are 3 tails
GLHF
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers49
Suggested Problems
-
Find the longest sequence of 1's in a binary sequence.
6847 Solvers
-
409 Solvers
-
329 Solvers
-
Double all elements in the array
2408 Solvers
-
696 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!