Skip to main content

Questions tagged [edit-distance]

Challenges which relate to calculating some type of edit distance (such as Levenshtein distance), or where answers are expected to satisfy some property related to edit distance.

6 votes
6 answers
937 views

Input A binary string \$s\$ of length \$n\$ and a positive integer \$k \leq n\$. Output The number of binary strings with Levenshtein distance exactly \$k\$ from the string \$s\$. Example outputs Each ...
Simd's user avatar
  • 3,167
7 votes
3 answers
641 views

I have string \$s\$ of length \$n\$ and some constant integer \$k\$ which is at most \$n\$. Give the fastest algorithm to sample a random string with Levenshtein distance \$k\$ from \$s\$ uniformly. ...
Simd's user avatar
  • 3,167
10 votes
2 answers
550 views

Given two strings \$A\$ and \$B\$ with edit (Levenshtein) distance \$x\$, find a third string with edit distance \$a\$ to \$A\$ and edit distance \$b\$ to \$B\$ so that \$a+b=x\$ and \$a=int(x/2)\$ (...
Simd's user avatar
  • 3,167
18 votes
7 answers
2k views

Inspired by this Your task today: given two strings, find the string with the lowest maximum Levenshtein distance to the input strings. For example, using Steffan ...
Seggan's user avatar
  • 7,131
11 votes
6 answers
403 views

Take as input two strings \$A\$ and \$B\$. Output a string \$C\$ that is \$A\$ but with two characters swapped such that the Levenshtein distance \$d(C,B)\$ is as small as possible. You must swap ...
Wheat Wizard's user avatar
  • 103k
17 votes
23 answers
2k views

Given a list of the integers from \$1\$ to some \$n\$, give the minimum number of adjacent swaps required to put the list in ascending order. You will receive a list as input and should output a non-...
Wheat Wizard's user avatar
  • 103k
5 votes
2 answers
836 views

Your task, at the moment that you choose to accept it, is to write a program that, when given a string and a PCRE-regex, calculates the minimum Levenshtein distance to another string that matches the ...
user avatar
10 votes
4 answers
262 views

The word "levencycle" is inspired by cyclic levenquine challenge. Definitions A 1-dup permutation of order \$n\$ is some permutation of \$1, \cdots, n\$ plus one duplicate number in the ...
Bubbler's user avatar
  • 79.3k
10 votes
5 answers
734 views

This challenge is about the following variant of edit distance. Say we have a cost of 1 for inserts, deletes and substitutions as usual with one exception. A substitution for a given letter ...
user avatar
6 votes
1 answer
361 views

The Levenshtein distance between two strings is the minimum number of single character insertions, deletions and substitutions needed to transform one string into the other. Let us call insertions, ...
user avatar
16 votes
4 answers
1k views

The edit distance between two strings is the minimum number of single character insertions, deletions and substitutions needed to transform one string into the other. This task is simply to write ...
user avatar
10 votes
13 answers
1k views

This is the Robber post. The Cop post is here. Your task is to take an integer input N and output the Nth digit in the sequence OEIS A002942. The sequence consists of the square numbers written ...
Stewie Griffin's user avatar
15 votes
15 answers
2k views

This is the Cop post. The Robber post is here. Your task is to take an integer input N and output the Nth digit in the sequence OEIS A002942. The sequence consists of the square numbers written ...
Stewie Griffin's user avatar
13 votes
7 answers
706 views

The Levenshtein edit distance between two strings is the minimum possible number of insertions, deletions, or substitutions to convert one word into another word. In this case, each insertion, ...
Stephen's user avatar
  • 14.2k
46 votes
23 answers
5k views

While there are many edit distance questions, such as this one, there isn't a simple question to write a program that calculates the Levenshtein distance. Some Exposition The Levenshtein edit ...
Sherlock9's user avatar
  • 12.4k

15 30 50 per page