feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent b434eb3a49
commit a7d29b7cce
203 changed files with 4526 additions and 0 deletions

View File

@@ -10,6 +10,26 @@ categories:
patterns:
- two-pointers
function_signature: "def is_alien_sorted(words: list[str], order: str) -> bool:"
test_cases:
visible:
- input: { words: ["hello", "leetcode"], order: "hlabcdefgijkmnopqrstuvwxyz" }
expected: true
- input: { words: ["word", "world", "row"], order: "worldabcefghijkmnpqstuvxyz" }
expected: false
- input: { words: ["apple", "app"], order: "abcdefghijklmnopqrstuvwxyz" }
expected: false
hidden:
- input: { words: ["a"], order: "abcdefghijklmnopqrstuvwxyz" }
expected: true
- input: { words: ["a", "b", "c"], order: "abcdefghijklmnopqrstuvwxyz" }
expected: true
- input: { words: ["app", "apple"], order: "abcdefghijklmnopqrstuvwxyz" }
expected: true
- input: { words: ["a", "a"], order: "abcdefghijklmnopqrstuvwxyz" }
expected: true
description: |
In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different `order`. The `order` of the alphabet is some permutation of lowercase letters.