feat(content): function signatures + test cases
This commit is contained in:
@@ -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`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user