← 返回 cisco 的题目列表Minimum Insertions / Deletions Password Update
类型:qbank
Given a current password and a target password, return the minimum number of character insertions and deletions needed to transform the current string into the target string.
Requirements
Input line 1 is currPassword, the current password.
Input line 2 is newPassword, the target password.
Allowed operations are character insertions and deletions only.
Return the minimum number of updates required to transform currPassword into newPassword.
Python screenshots show a stub shaped like funcUpdation(currPassword, newPassword).
Examples
Input:
password
pss$w#rd
Output:
4
Explanation: delete a and o, then insert $ and #.
Notes
This is an LCS-style edit-distance variant: with replacements disallowed, the minimum operation count is len(a) + len(b) - 2 * LCS(a, b).
The prompt language frames this as improving weak passwords, but no password-policy validation is required.