add new solutions

This commit is contained in:
Yiyang Kang 2026-03-01 13:45:00 +09:00
parent ee1868a10e
commit 2012261d3d
7 changed files with 205 additions and 0 deletions

View file

@ -0,0 +1,20 @@
// Package q1680 implements a solution for https://leetcode.com/problems/concatenation-of-consecutive-binary-numbers/
package q1680
const MOD int = 1e9 + 7
func concatenatedBinary(n int) int {
ret := 0
binLen := 1
for c := 1; c <= n; c++ {
if 1<<binLen <= c {
binLen++
}
ret = (ret<<binLen + c) % MOD
}
return ret
}
var _ = concatenatedBinary