why my solution is wrong?


  • 0
    I
    public int reverseBits(int n) {
                    long m = (long) Math.pow(2, 31);
    		long res = 0;
    		for(;n!=0;n>>=1){
    		if ((n & 1) == 1)
    		res = res + m;
    		m /= 2;
    		}
    		return (int) res;
        }
    
    Submission Result: Time Limit Exceeded 
    Last executed input:   2147483648

Log in to reply
 

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