feat(content): function signatures + test cases
This commit is contained in:
@@ -8,6 +8,32 @@ categories:
|
||||
patterns:
|
||||
- greedy
|
||||
|
||||
function_signature: "def has_alternating_bits(n: int) -> bool:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { n: 5 }
|
||||
expected: true
|
||||
- input: { n: 7 }
|
||||
expected: false
|
||||
- input: { n: 11 }
|
||||
expected: false
|
||||
hidden:
|
||||
- input: { n: 1 }
|
||||
expected: true
|
||||
- input: { n: 2 }
|
||||
expected: true
|
||||
- input: { n: 10 }
|
||||
expected: true
|
||||
- input: { n: 21 }
|
||||
expected: true
|
||||
- input: { n: 15 }
|
||||
expected: false
|
||||
- input: { n: 1431655765 }
|
||||
expected: true
|
||||
- input: { n: 4 }
|
||||
expected: false
|
||||
|
||||
description: |
|
||||
Given a positive integer `n`, check whether it has **alternating bits**: namely, if two adjacent bits will always have different values.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user