Company: Amazon_13sep
Difficulty: medium
Retrieve Missing Data Problem Description The Data Science Team at Amazon has lost a piece of data from its database. The team believes it can recover the missing data from the following information: The missing data is a permutation of the characters of the string firstInfo (it uses every character of firstInfo exactly once, in some order). The missing data is lexicographically greater than the string secondInfo . The missing data is the lexicographically smallest string that satisfies the two conditions above. In other words, find the smallest string that meets these criteria. A string x is lexicographically smaller than a string y if: x[i] < y[i] at the first position i where x and y differ, or |x| < |y| and x is a prefix of y (where |x| denotes the length of string x ). Given two strings firstInfo and secondInfo , find the missing data that matches the criteria above. If no such string exists, return "-1" . Complete the function retrieveData(firstInfo, secondInfo) . It return