feat(content): more test cases

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

View File

@@ -10,6 +10,24 @@ categories:
patterns:
- dynamic-programming
function_signature: "def word_break(s: str, word_dict: list[str]) -> bool:"
test_cases:
visible:
- input: { s: "leetcode", word_dict: ["leet", "code"] }
expected: true
- input: { s: "applepenapple", word_dict: ["apple", "pen"] }
expected: true
- input: { s: "catsandog", word_dict: ["cats", "dog", "sand", "and", "cat"] }
expected: false
hidden:
- input: { s: "a", word_dict: ["a"] }
expected: true
- input: { s: "aaaaaaa", word_dict: ["aaaa", "aaa"] }
expected: true
- input: { s: "cars", word_dict: ["car", "ca", "rs"] }
expected: true
description: |
Given a string `s` and a dictionary of strings `wordDict`, return `true` if `s` can be segmented into a space-separated sequence of one or more dictionary words.