• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Question - need solution asap (in java)

Status
Not open for further replies.

Knight_Killer

Active member
Trusted Uploader
Aug 28, 2020
170
107
43

Shil is your new boss and he likes lucky strings very much. A string​

is called lucky if and only if each character from first half of the string can be paired to each character from second half of the string. AND: In each pair, a character from the first half is strictly greater than a character from the second half OR In each pair, a character from the first half is strictly lesser than a character from the second half OR In each pair, a character from the first half is equal to character from the second half. Each character should be used exactly once in pairing. Your are given a string S. You want to change the minimum number of characters to make this string lucky so that you can gift it to your boss. Note that each character in lucky string should be in lower case alphabet ( 'a' - 'z' ). Input format: The first line consists of an integer N. The second line consists of N lower case characters. Output format: Print minimum number of changes required to make given string lucky. Constraints: 1 < N ≤ 105 N will be an even integer.
 
Status
Not open for further replies.
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock