Convert Simple Password to Complex
Learn this problemProblem statement
A company's IT department is faced with a dilemma that users keep using simple passwords such as "password", "abc123" etc.
You are tasked with a challenge to write an algorithm to identify the total minimum number of changes (insertions and deletions) of characters to convert these simple passwords to their more difficult versions.
Input
The first line of input consists of a string-currPassword, representing the current password. The second line consists of a string-newPassword, representing the new password.
Output
Print an integer representing the minimum number of updates required (character insertions and deletions) to convert the current password into the new password.
Function
minUpdates(currPassword: String, newPassword: String) → intExamples
Example 1
currPassword = "password"newPassword = "pss$w#rd"return = 4The current password is "password" and the new password is "pss$w#rd"; we need to delete 'a' and 'o' (2 operations) and insert '$' and '#' (2 operations) to convert the current password into the new password. So, the output is 4.
More Cisco problems
- Collect CoinsSeen Jun 2025
- FizzBuzz ProblemSeen May 2025
- Find Largest Sum Contiguous SubarraySeen May 2025
- Find Largest Sum of Continuous SequenceSeen May 2025
- Find Palindrome Sub-stringSeen May 2025
- Count Numbers with Digit SumSeen Mar 2025
- Maximum Chocolates from Jars (L.C. 198 :)Seen Mar 2025
- Find Elements Largest in Row Smallest in ColumnSeen Mar 2025