All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g0401_0500.s0476_number_complement.Solution Maven / Gradle / Ivy

There is a newer version: 1.37
Show newest version
package g0401_0500.s0476_number_complement;

// #Easy #Bit_Manipulation #2022_07_20_Time_0_ms_(100.00%)_Space_40.7_MB_(65.79%)

public class Solution {
    public int findComplement(int num) {
        return ~num & ((Integer.highestOneBit(num) << 1) - 1);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy