feat(content): more test cases

This commit is contained in:
2025-07-13 19:25:39 +01:00
parent 98ebb1600f
commit 16b02451d0
94 changed files with 1840 additions and 0 deletions

View File

@@ -8,6 +8,32 @@ categories:
patterns:
- greedy
function_signature: "def reverse(x: int) -> int:"
test_cases:
visible:
- input: { x: 123 }
expected: 321
- input: { x: -123 }
expected: -321
- input: { x: 120 }
expected: 21
hidden:
- input: { x: 0 }
expected: 0
- input: { x: -120 }
expected: -21
- input: { x: 1534236469 }
expected: 0
- input: { x: -2147483648 }
expected: 0
- input: { x: 2147483647 }
expected: 0
- input: { x: 1463847412 }
expected: 2147483641
- input: { x: -1 }
expected: -1
description: |
Given a signed 32-bit integer `x`, return `x` *with its digits reversed*. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-2^31, 2^31 - 1]`, then return `0`.