Implement the functionality to solve a code lock problem based on the provided function signature and implementation of solve_code_lock(n, s, t). The main goal is to transform the string t into string s using a minimum number of operations.
Functionality Requirements
Create a function named solve_code_lock that takes three parameters:
An integer n representing the length of string s and t.
A string s which is the target string we want to achieve.
A string t which is the starting string that needs to be transformed into s.
The function should:
Return -1 if strings s and t do not contain the same characters in the same frequency.
Return a tuple containing:
An integer representing the number of operations required to transform t into s.
A list of integers representing the operations performed.
Input/Output Requirements
Input:
An integer n (1 ≤ n ≤ 100) for the length of strings.
A string s consisting of n lowercase letters.
A string t consisting of n lowercase letters.
Output:
A tuple (num_operations, operations_list) where:
num_operations is the total number of operations performed.
operations_list is a list containing the sequence of operations. Operations should be defined as follows:
Moving a character to the front of the string should use its index.
Example:
Input: solve_code_lock(5, "abcde", "edcba")
Output: (6, [4, 3, 1, 2, 1, 0])
Implementation Note
The solution must be written in a file called /app/solution.py.
Follow the provided code structure and ensure any new functionality integrates smoothly with the existing logic.