How can I solved this ? Already seen editorial but it is hard to understand.

Try this:

https://www.hackerrank.com/challenges/equal/submissions/code/49311904

I think itâ€™s fundamentally quite a tough problem to explain.

Edit:

Link for people without a Hackerrank account.

Yup. And may be itâ€™s just me but I think that problems on Hackerrank arenâ€™t well-distributed according to difficulty. Letâ€™s say you just take DP as a topic to practice and sort the questions by difficulty, now, the first question is really easy - the direct application of Kadaneâ€™s Algorithm but itâ€™s start getting really tough from there within just 2-3 problems, such as with this one. Compare it to SPOJ or even Codechef, they do have a lot of tough problem but from my experience, the curve of difficulty vs the ith problem is less steep.

Hmmm â€¦ works for me - do you have a Hackerrank account that you are logged into?

@ro_hitt - does the link work for you?

Yes, my bad, sorry. It requires you to login. The link works fine.

Just solved it this morning

Yep, it happens quite frequently, i look at the max score, and think â€śyo this is easyâ€ť and it turns out to be harder than its rated. Lol and easyier problems sometimes are rated as harder, ex. Coin change problem has max score 60.

No , But one you provided cpp file , I have downloaded that.

Quick reminder that Two Two is worth a whopping 150(!) points and was once rated as Expert - Iâ€™m pretty sure that difficulty ratings and number of points are assigned at random

Thank you for this problem.

Thanks Iâ€™ll try, desperate need some points to get â€śstarsâ€ť in problem solving on hackerrank

Nice problem. My bad that I didnâ€™t read carefully that the powers of 2 can only be up to 800, i.e. for any 2^{x}, x can only be in 1 \leqslant x \leqslant 800, I need to learn to read problems more carefully . Then I think, just building up a Trie for the 800 powers of 2 and then searching each substring of T in that Trie would suffice. Someone mentioned in discussion there that Aho-Corasick would do better. So, time to learn that. Thank you for it.