Feature #8: Similarity Measure Between DNA Samples

Implement the "Similarity Measure Between DNA Samples" feature for our "Computational Biology" project.

Description

The DNA of an alien species consists of a sequence of nucleotides, where each nucleotide is represented by a letter. We received two such DNA samples, and we need to measure the extent of similarity—also known as the edit distance—between them. The prevalent measure of similarity between these two samples is the minimum number of edits that are required to convert one DNA sample to the other.

Note: We are only permitted to insert, delete, or update a nucleotide in a DNA sample.

Given two DNA samples as strings, sample1 and sample2, we have to return the minimum number of operations that are required to convert sample1 to sample2.

The following examples may clarify this problem:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.