We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fa5f401 commit ba33ca7Copy full SHA for ba33ca7
src/main/java/com/fishercoder/solutions/_1680.java
@@ -0,0 +1,17 @@
1
+package com.fishercoder.solutions;
2
+
3
+public class _1680 {
4
+ public static class Solution1 {
5
+ public int concatenatedBinary(int n) {
6
+ final int MOD = 1000000007;
7
+ int result = 0;
8
+ for (int i = 1; i <= n; i++) {
9
+ String binary = Integer.toBinaryString(i);
10
+ for (int j = 0; j < binary.length(); j++) {
11
+ result = (result * 2 + (binary.charAt(j) - '0')) % MOD;
12
+ }
13
14
+ return result;
15
16
17
+}
0 commit comments