Codesignal assessment: Duplicate DNAs VERY TRICKY!!
Anonymous User
1864

Given a String reference and a list of strings candidates, compute the number of candidate sequences that are similar to the reference sequence.

Two strings are similar if any rotation of the strings are within 3 substitutions of each other.

Examples:

  • GAAAAAA and GAAATTT are similar because you could replace the last 3 A's with Ts to get from the first to the second
  • GAAAAAA and AAATTTG are similar because you could replace the last 3 A's with Ts and rotate one character to the left to get from the first string to the second string
  • GAAAAAA and GAATTTT are not similar because you need to make at least 4 substitutions to get from the first string to the second string.

Example Input:
reference: GAAAAAA
candidates: [GAAATTT, AAATTTG, GAATTTT]

Output:
2

Comments (2)