GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • rulcode
  • Sign In

This view

  • Original page
  • New address

GeezerVison is showing rulcode.com — Edit Distance Visualizer & Solution | Rulcode

Fetching algorithms...

    Edit Distance Visualizer & Solution | Rulcode
    Loading problem details...

    34. Edit Distance

    PRO
    Hard
    Topics
    Companies
    Hint

    Understand Before Coding

    Visualize This Problem
    Open Visualizer
    Draw Your Approach
    Draw

    Example 1:

    Input: word1 = "horse", word2 = "ros"
    Output: 3
    Explanation: horse -> rorse (replace 'h' with 'r') rorse -> rose (remove 'r') rose -> ros (remove 'e') The minimum edit distance between "horse" and "ros" is 3 (replace 'h' with 'r', remove 'r', remove 'e').

    Example 2:

    Input: word1 = "intention", word2 = "execution"
    Output: 5
    Explanation: intention -> inention (remove 't') inention -> enention (replace 'i' with 'e') enention -> exention (replace 'n' with 'x') exention -> exection (replace 'n' with 'c') exection -> execution (insert 'u') The minimum edit distance between "intention" and "execution" is 5.

    Example 3:

    Input: word1 = "", word2 = "abc"
    Output: 3
    Explanation: The minimum edit distance between "" and "abc" is 3 (insert 'a', insert 'b', insert 'c').

    Example 4:

    Input: word1 = "abc", word2 = ""
    Output: 3
    Explanation: The minimum edit distance between "abc" and "" is 3 (delete 'a', delete 'b', delete 'c').

    Example 5:

    Input: word1 = "abc", word2 = "abc"
    Output: 0
    Explanation: The minimum edit distance between "abc" and "abc" is 0 (no operations needed).

    Constraints:

    • •
    • •

    Time Complexity

    O(mn)

    Space Complexity

    O(mn)

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.