
g0401_0500.s0476_number_complement.Solution Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java17 Show documentation
Show all versions of leetcode-in-java17 Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
package g0401_0500.s0476_number_complement;
// #Easy #Bit_Manipulation #2022_03_18_Time_0_ms_(100.00%)_Space_41.7_MB_(9.65%)
public class Solution {
public int findComplement(int num) {
return ~num & ((Integer.highestOneBit(num) << 1) - 1);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy