Since Cody, I dislike for-loops, but your solution is way simpler than my own algorithm. Mission accomplished...
Nevertheless, I would hope for a non-looped piece of code. Let's see in phase 3.
Given an unsigned integer x, find the largest y by rearranging the bits in x
817 Solvers
203 Solvers
142 Solvers
Sum of diagonal of a square matrix
1339 Solvers
Check if number exists in vector
5023 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!