We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bb28c0e + ed9eaee commit a536abfCopy full SHA for a536abf
counting-bits/s0ooo0k.java
@@ -0,0 +1,12 @@
1
+class Solution {
2
+ public int[] countBits(int n) {
3
+ int[] arr = new int[n + 1];
4
+
5
+ for (int i = 1; i <= n; i++) {
6
+ arr[i] = arr[i >> 1] + (i & 1);
7
+ }
8
9
+ return arr;
10
11
+}
12
missing-number/s0ooo0k.java
@@ -0,0 +1,16 @@
+ public int missingNumber(int[] nums) {
+ int n = nums.length;
+ boolean[] dp = new boolean[n+1];
+ for(int i=0; i<n; i++) {
+ dp[nums[i]]=true;
+ for(int i=0; i<=n; i++) {
+ if(dp[i]==false) return i;
13
+ return 0;
14
15
16
0 commit comments