Company: Juspay_3july
Difficulty: medium
Encrypted File Name Update Problem Description In a cloud storage system, files are assigned encrypted names consisting of lowercase English letters. When a file is updated, its encrypted name must also be updated following strict rules: The new file name must be exactly k characters long. The new file name can only include characters that are present in the original file name. The new file name must be lexicographically larger than the original file name. This means it should come later than the original name if they were arranged in alphabetical order. Given the original file name, find the smallest possible new file name of length k that satisfies these conditions. Return "-1" if no such name is possible. Note: A string p is lexicographically smaller than string q if p comes before q in the dictionary. For example, "abc" is smaller than "abcd", and "abd" is smaller than "abe". Function Description Complete the solve function in the editor below. It has the following parameter(s): n