##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
3 ACGT TGCA AAAA
1
4 AAA TTT AAA TTT
The complement of AAA is TTT. Complementary pairs: (AAA at index 0, TTT at index 1), (AAA at index 0, TTT at index 3), (AAA at index 2, TTT at index 1), (AAA at index 2, TTT at index 3). Answer: 4.
4
5 AT TA CG GC AA
Complement of AT is TA, so (AT, TA) is a pair. AT is also the complement of TA, counted once. Complement of CG is GC, so (CG, GC) is a pair. AA's complement is TT which is not present. Answer: 2.
2
Given DNA sequences (strings over the alphabet ), count the number of complementary pairs.
Two DNA sequences are complementary if they have the same length and at every position, the characters are complements: and .
For example, and are complementary. and are complementary.
A pair with is counted if sequence and sequence are complementary.
The complement of ACGT is TGCA (AT, CG, GC, TA). So (ACGT, TGCA) form a complementary pair. AAAA's complement is TTTT, which is not present. Answer: 1.