I am getting the \"Must be an array type but it resolved to string\" error in my code. It also says that i (in the code below) cannot be resolved to a variable which I don\'
Your problem is with syntax dna[i], dna is a string and you access it as it would be an array by []. Use dna.charAt(i); instead.
dna[i]
dna
[]
dna.charAt(i);