Algorithm · Amazon · Medium
Build an autocomplete search bar that matches a given design. As the user enters text into the input field, show a dropdown of suggestions that match the current input. The input is considered to match a candidate if the candidate string contains the input as a substring (case‑sensitive). Hide the suggestion dropdown when the input is blank. Refresh the suggestion list every time the input value changes. Selecting a suggestion by clicking it sets the input value to that…