GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Sunday 17 July 2022

[Solution] Yet Another Palindrome Making Problem CodeChef Solution



Chef has a string A (containing lowercase Latin letters only) of length N where N is even. He can perform the following operation any number of times:

  • Swap Ai and Ai+2 for any 1i(N2)

Determine if Chef can convert string A to a palindromic string.

Note: A string is called a palindrome if it reads the same backwards and forwards. For example, noon and level are palindromic strings but ebb is not.

Input Format

  • The first line contains a single integer T — the number of test cases. Then the test cases follow.
Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

  • The first line of each test case contains an integer N — the length of the string A.
  • The second line of each test case contains a string A of length N containing lowercase Latin letters only.

Output Format

For each test case, output YES if Chef can convert the string A to a palindromic string. Otherwise,








 output NO.

You may print each character of YES and NO in either uppercase or lowercase (for example, yesyEsYes will be considered identical).

Constraints

  • 1T200
  • 1N1000

No comments:

Post a Comment