Company: Zomato_21july
Difficulty: medium
Binary Autocomplete Problem Description A console for an old motor controller accepts commands written as binary strings (strings made only of the characters 0 and 1 ). Implement its autocomplete feature. Commands are entered one after another. When a new command is typed, autocomplete looks only at the commands entered before it and displays one of them: It displays the previously entered command that shares the longest common prefix with the new command. If several previous commands share that same longest prefix length, it displays the most recent of them (the one entered last). If no previous command shares a common prefix with the new command (every previous command starts with a different first character), it displays the most recent previous command. If there are no previous commands, it displays nothing, reported as 0 . Commands are numbered from 1 in the order they were entered. For each command, report the number of the command autocomplete displays while it is being typed. A