Company: Swiggy_16oct
Difficulty: medium
Auto Suggest Problem Description A dictionary of N words is given along with a query word S. You must pick the single dictionary word that best serves as an autocomplete suggestion for S. Words are ranked first by their Levenshtein distance from S; whichever word is closer wins. When two words tie on distance, the one that is lexicographically smaller is preferred. Notes: Levenshtein distance between two strings is defined as the minimum number of edits required to obtain one string from the other. An "edit" is defined by either an insertion of a character, a deletion of a character, or a replacement of a character. Levenshtein distance between "abc" with "ac" is 1 (deletion of c), with "abd" is 1 (replacement of c to d) and with "abcd" is 1 (insertion of d). All the words and the query word S consist of lowercase alphabets only. Function Description Complete the function solve . This function takes the following 3 parameters and returns the required answer: N: Represents the number of