Adjacent-pair swapping in a word: If you swap (1↔2), (3↔4), (5↔6), … in “COMMUNICATIONS”, which letter becomes the 10th from the right in the new arrangement?

Difficulty: Medium

Correct Answer: N

Explanation:


Introduction / Context:
Swapping adjacent pairs is a frequent test of string manipulation and indexing under time pressure. After performing the swaps, you must locate a letter by relative position (“10th from the right”) rather than by index from the left, which increases the likelihood of off-by-one mistakes.


Given Data / Assumptions:

  • Word: COMMUNICATIONS (14 letters): C O M M U N I C A T I O N S.
  • Operation: swap (1↔2), (3↔4), (5↔6), (7↔8), (9↔10), (11↔12), (13↔14).
  • Query: identify the 10th letter from the right after swapping.


Concept / Approach:
Execute pairwise swaps carefully, then convert the “10th from right” into a left index: for a 14-letter string, the 10th from the right is position 14 − 10 + 1 = 5 from the left.


Step-by-Step Solution:

Original indices (1..14): C(1) O(2) M(3) M(4) U(5) N(6) I(7) C(8) A(9) T(10) I(11) O(12) N(13) S(14).After swaps: (1↔2) → O C; (3↔4) → M M; (5↔6) → N U; (7↔8) → C I; (9↔10) → T A; (11↔12) → O I; (13↔14) → S N.Resulting string: O C M M N U C I T A O I S N.10th from right = 5th from left. The 5th character is N.


Verification / Alternative check:
Count from the right explicitly: N(1), S(2), I(3), O(4), A(5), T(6), I(7), C(8), U(9), N(10). The 10th from right is N, confirming the earlier index conversion.


Why Other Options Are Wrong:

  • U / A / T match nearby positions but not the exact index (off-by-one traps).
  • None of these: Not applicable because N is correct.


Common Pitfalls:
Miscounting from the right; forgetting to convert right-based indexing to left-based index correctly for even-length strings.


Final Answer:
N

More Questions from Coding Decoding

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion