PRFCTSTR - Editorial

PROBLEM LINK:

Practice

Author: Manas Rawat
Tester: Satendra Rai
Editorialist: Manas Rawat

DIFFICULTY:

CAKEWALK

PREREQUISITES:

Sorting

PROBLEM:

You have been given a string and you are asked that if we divide the string into two parts according to the question then will those two parts be individually be sorted.

QUICK EXPLANATION:

You can make a copy of the original string and save it in a temporary string and then apply sorting operations to the individual halves of the string (NOTE : Sorting does not need to be done on the whole string it needs to be done on the two halves separately). Sorting can be done easily using the inbuilt functions in the language that you are using.

After sorting just compare the new string with the original string. If they are equal then the string is perfect otherwise it is not perfect.

SOLUTIONS:

Solution can be found here.