Codeforces B. Zuhair and Strings Codeforces Round #533 (Div. 2) 1105B 533B


Problem link

Since all the substrings of length k must be of the same latter, we can iterate over all letters from 'a' to 'z' and for each letter count the number of disjoint substrings of length k and take the maximum one.


A solution in c++


Post a Comment

1 Comments

  1. In line 41: if(arr[i] == arr[i - 1]){

    This code gives error when i=0 then arr[0] == arr[-1] which is incorrect statement.

    ReplyDelete

If you have any doubts, Please let me know