PROBLEM LINK:
Author: Manisha Reddy Thirumala Reddy
Tester: Manisha Reddy Thirumala Reddy
DIFFICULTY:
CAKEWALK.
PREREQUISITES:
Strings, Arrays.
PROBLEM:
Given a string s with n characters, we need to perform the following steps:
- swap adjacent characters.
- swap every alphabet with its ASCII reverse alphabet. Ex: For ‘a’ the reverse ASCII value is ‘z’.
we can do this by ASCII values (char)(122-‘a’+97) = ‘z’.
EXPLANATION:
As it is very easy question, the code snippet will guide you.
for(int i=0; i<len; i = i+2){
temp = en[i+1];
en[i+1]=en[i];
en[i]=temp;
}
AUTHOR’S AND TESTER’S SOLUTIONS:
Author’s solution can be found here.