Question - need solution asap (in java)

Status
Not open for further replies.

Knight_Killer

Active member
Trusted Uploader
Aug 28, 2020
135
94
28

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.

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu