-
-
Notifications
You must be signed in to change notification settings - Fork 291
Expand file tree
/
Copy path1017.java
More file actions
17 lines (17 loc) · 662 Bytes
/
1017.java
File metadata and controls
17 lines (17 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
__________________________________________________________________________________________________
sample 0 ms submission
class Solution {
public String baseNeg2(int N) {
return Integer.toBinaryString(1431655765 ^ (1431655765 - N));
}
}
__________________________________________________________________________________________________
sample 35560 kb submission
class Solution {
public String baseNeg2(int N) {
int num = 1;
while (num < N) num = (num << 2) + 1;
return Integer.toBinaryString(num ^ (num - N));
}
}
__________________________________________________________________________________________________