Company: Uber_all
Difficulty: medium
1. Binary Autocomplete Problem Description The programming interface for a legacy motor controller accepts commands as binary strings of variable length. The console has a very primitive autocomplete/autocorrect feature: as a new command is entered one character at a time, it will display the previously entered command that shares the longest common prefix . If multiple commands are tied, it displays the most recent one . If there is no previous command that shares a common prefix, it will display the most recent command. Given a sequence of commands entered into the console, for each command, determine the index of the command last displayed by the autocomplete as it was entered. Return 0 if there is none. Examples Example 1: Input: command = ["000", "1110", "01", "001", "110", "11"] Output: [0, 1, 1, 1, 2, 5] Explanation: '000' - 0 (No command has previously been entered) '1110' - 1 (There is no previous command that shares a common prefix, so the last command is shown) '01' - 1 ('00