Z58
Search Autocomplete System
Problem Statement & Objective
Design a search autocomplete system for a search engine where users type sentences and receive the top 3 historical suggestions.
Function Signature (Python)
search_autocomplete_system(sentences: list[str], times: list[int], inputs: str) -> list[list[str]]Input & Output Contract
Output Rule:Her karakter girişi için en fazla 3 öneri cümlesi içeren liste listesi.
System Constraints
1 <= cumleler.length <= 100
1 <= zamanlar[i] <= 50
1 <= girdiler.length <= 200
girdiler sadece küçük harf, boşluk ve '#' içerirExample Execution Walkthrough
cumleler = ['i love you', 'island', 'iroman'], zamanlar = [5, 3, 2], girdiler = 'i love you#'
'i' -> ['i love you', 'island', 'iroman']
' ' -> ['i love you']
'l' -> ['i love you']
'o' -> ['i love you']
'v' -> ['i love you']
'e' -> ['i love you']
' ' -> ['i love you']
'y' -> ['i love you']
'o' -> ['i love you']
'u' -> ['i love you']
'#' -> []Example Test Scenarios (3)
Example 1: Eşleşme ve Sıfırlama
Input:
[["i love you","island","iroman","i love python"],[5,3,2,2],"i#"]Expected Output:
[["i love you","island","i love python"],[]]Example 2: Eşit Frekansta ASCII Sıralaması
Input:
[["abc","abbc","a"],[3,3,3],"a#"]Expected Output:
[["a","abbc","abc"],[]]Example 3: Boş Başlangıç
Input:
[[],[],"hi#"]Expected Output:
[[],[],[]]