Are they same(divide and conquer)

got my solution accepted on coding blocks
but getting tle on codeforces


https://codeforces.com/problemset/problem/559/B
https://hack.codingblocks.com/contests/c/547/828

Codeforces wants you to solve it in O(n logn). Check constraints length of string is upto 200000.

whats the complexity of my code and can u provide soln for nlogn approach

https://codeforces.com/blog/entry/19237
Here try to read Editorial