feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent d65ccf7dc2
commit 0262ca8bf6
203 changed files with 4526 additions and 0 deletions

View File

@@ -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.