feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent 9e6c6d256f
commit 65a8d525f5
203 changed files with 4526 additions and 0 deletions

View File

@@ -8,6 +8,30 @@ categories:
patterns:
- two-pointers
function_signature: "def binary_gap(n: int) -> int:"
test_cases:
visible:
- input: { n: 22 }
expected: 2
- input: { n: 8 }
expected: 0
- input: { n: 5 }
expected: 2
hidden:
- input: { n: 1 }
expected: 0
- input: { n: 6 }
expected: 1
- input: { n: 9 }
expected: 3
- input: { n: 15 }
expected: 1
- input: { n: 17 }
expected: 4
- input: { n: 1073741824 }
expected: 0
description: |
Given a positive integer `n`, find and return *the **longest distance** between any two **adjacent*** `1`*'s in the binary representation of* `n`. If there are no two adjacent `1`'s, return `0`.