I think your code is great,but it can accpet without saving 32 bit


  • 4
    L
    public class Solution {
    public int singleNumber(int[] A) {
        int key;
        int result=0;
        for(int i=0;i<32;i++){
            key=0;
            for(int j=0;j<A.length;j++){
                key+=(A[j]>>i)&1;
            }
            result|=((key%3)<<i);
        }
        return result;
    }
    

    }


  • 1
    L

    maybe it can accept 32 bit or 64 bit
    i<8*sizeof(int)


  • 0
    S

    I'm not sure what the question is. Was this solution accepted?


Log in to reply
 

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