Given two strings s and p of the same length n and q queries, each giving a range L to R, swap the characters of s and p within the range for each query and print the final string after all operations.
Asked in the DSA round stage. In this SQL version, each row in string_pairs is an independent test case. Ignore queries with a missing range boundary.
case_id and final_string.case_id ascending.| Column | Type | Description |
|---|---|---|
| case_idPK | INT | Identifier for an independent string test case |
| s | VARCHAR(100) | First input string |
| p | VARCHAR(100) | Second input string with the same length as s |
| Column | Type | Description |
|---|---|---|
| query_idPK | INT | Identifier for a range query |
| case_id | INT | Test case receiving the query |
| left_pos | INT | Inclusive left endpoint of the range |
| right_pos | INT | Inclusive right endpoint of the range |