one line solution in Java


  • 0
    C
    public class Solution {
        // you need treat n as an unsigned value
        public int reverseBits(int n) {
           return Integer.reverse(n);
        }
    }
    

    no kidding :)


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.