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