feat(content): hidden test cases

This commit is contained in:
2025-08-06 23:21:42 +01:00
parent 72f7833c6c
commit a1a4eeaed7
134 changed files with 2075 additions and 0 deletions

View File

@@ -11,6 +11,24 @@ patterns:
- backtracking
- dynamic-programming
function_signature: "def word_break(s: str, word_dict: list[str]) -> list[str]:"
test_cases:
visible:
- input: { s: "catsanddog", word_dict: ["cat", "cats", "and", "sand", "dog"] }
expected: ["cat sand dog", "cats and dog"]
- input: { s: "catsandog", word_dict: ["cats", "dog", "sand", "and", "cat"] }
expected: []
hidden:
- input: { s: "pineapplepenapple", word_dict: ["apple", "pen", "applepen", "pine", "pineapple"] }
expected: ["pine apple pen apple", "pine applepen apple", "pineapple pen apple"]
- input: { s: "a", word_dict: ["a"] }
expected: ["a"]
- input: { s: "ab", word_dict: ["a", "b"] }
expected: ["a b"]
- input: { s: "aaaa", word_dict: ["a", "aa"] }
expected: ["a a a a", "a a aa", "a aa a", "aa a a", "aa aa"]
description: |
Given a string `s` and a dictionary of strings `wordDict`, add spaces in `s` to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in **any order**.