File: root - text - article - 2019 - 10 - edit-distance.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 989 Views, 20120 Search Bots | 80 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 989 Views, 20120 Search Bots | 80 Words
| Browse | Archive
Hi, here's your problem today. This problem was recently asked by AirBNB:
Given two strings, determine the edit distance between them. The edit distance is defined as the minimum number of edits (insertion, deletion, or substitution) needed to change one string to the other.
For example, "biting" and "sitting" have an edit distance of 2 (substitute b for s, and insert a t).
Here's the signature:
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Cateogry: Computing | 989 Views, 20120 Search Bots | 80 Words Given two strings, determine the edit distance between them. The edit distance is defined as the minimum number of edits (insertion, deletion, or substitution) needed to change one string to the other.
For example, "biting" and "sitting" have an edit distance of 2 (substitute b for s, and insert a t).
Here's the signature:
def distance(s1, s2):
# Fill this in.
print distance('biting', 'sitting')
# 2
Related Articles
- Daily Interview Puzzle: Minimum Size Subarray Sum
- Daily Interview Problem:Create a balanced binary search tree
- Algorithm Interview Question: H-Index
- Fix Brackets
- Skip the readings, focus on problems. And use all the hints!
- Daily Interview Problem: Minimum Removals for Valid Parenthesis
- Algorithm Interview: Convert Roman Numerals to Decimal
- [Daily Problem] Validate Balanced Parentheses
- Daily Interview Problem: Arithmetic Binary Tree
- Two Tricks of Delphi
©2006~2024 SteakOverCooked - 0.00817 Seconds(s) - 2359.179 KB/s - 39 Online Memory: 492.54 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="index, follow">
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !