Cisco interview question
Minimum character insertions and deletions to turn one password into another
- Company:
- Cisco
- Type:
- Coding
- Difficulty:
- Medium
- Reported:
- October 19, 2026
Problem
You are given the current password current and the new password target. In one operation you can either insert one character anywhere in current or delete one character from it. Return the minimum number of operations needed to turn current into target.
Example 1
Input: current = "abcde", target = "abxde"
Output: 2
Delete c and insert x in its place. Changing a character in place is not an operation, so it costs a deletion plus an insertion.
Example 2
Input: current = "pass12", target = "1pass"
Output: 3
Keep "pass", delete 1 and 2 from the end, and insert 1 at the front.
Constraints
- Either string may be empty.
- Both strings may contain any characters.
Reported by candidates or drawn from publicly available sources, and rewritten in our own words. Pathwise Prep does not publish confidential assessment content. Report a concern