feat(content): function signatures + test cases
This commit is contained in:
@@ -10,6 +10,26 @@ categories:
|
||||
patterns:
|
||||
- two-pointers
|
||||
|
||||
function_signature: "def add_spaces(s: str, spaces: list[int]) -> str:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { s: "LeetcodeHelpsMeLearn", spaces: [8, 13, 15] }
|
||||
expected: "Leetcode Helps Me Learn"
|
||||
- input: { s: "icodeinpython", spaces: [1, 5, 7, 9] }
|
||||
expected: "i code in py thon"
|
||||
- input: { s: "spacing", spaces: [0, 1, 2, 3, 4, 5, 6] }
|
||||
expected: " s p a c i n g"
|
||||
hidden:
|
||||
- input: { s: "abc", spaces: [1] }
|
||||
expected: "a bc"
|
||||
- input: { s: "abc", spaces: [0] }
|
||||
expected: " abc"
|
||||
- input: { s: "EnjoyYourCoffee", spaces: [5, 9] }
|
||||
expected: "Enjoy Your Coffee"
|
||||
- input: { s: "hello", spaces: [1, 2, 3, 4] }
|
||||
expected: "h e l l o"
|
||||
|
||||
description: |
|
||||
You are given a **0-indexed** string `s` and a **0-indexed** integer array `spaces` that describes the indices in the original string where spaces will be added. Each space should be inserted **before** the character at the given index.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user