Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

A problem with Strings

Правка en1, от priyanshbarya, 2023-11-04 22:32:37

Problem: Let us define the cost of string s to be the number of characters to be replaced such that the resulting string is rearrangeable to palindrome.

For e.g., let s="abc", the cost is 1 since we can change b to a (or b to c), and the resulting string will be rearrangeable to a palindrome.

You are given a string s (1<=length<=1e5). Find the sum of the cost of all the substrings.

Please help me out with this problem.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский priyanshbarya 2023-11-04 22:32:37 470 Initial revision (published)