For each prefix, filter products that start with it, sort, and take the first 3.
With products and search word of length , you filter products times: .
Can you avoid rescanning all products for each prefix?
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
The trap
For each prefix, filter products that start with it, sort, and take the first 3.
With products and search word of length , you filter products times: .
Can you avoid rescanning all products for each prefix?