Bubble Sort / Iterative Logic: The function scans the sequence and
replaces occurrences of target with replacement. If a replacement
creates a new instance of target (e.g., removing "CG" with "GC" in
the sequence "CCG" -> "CGC"), the new instance is also replaced. This continues
until the sequence is free of the target k-mer.
When target and replacement are permutations of each other
(e.g., "CG" and "GC"), this acts as a "bubble sort" of nucleotides, moving
bases locally without altering the total GC content or base counts of the genome.