Help in hackerrank problem

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.

4 Likes

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.

2 Likes

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

@ro_hitt - does the link work for you?

1 Like

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

1 Like

Just solved it this morning

1 Like

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.

2 Likes

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

1 Like

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 :slight_smile:

3 Likes

Thank you for this problem.

1 Like

Thanks I’ll try, desperate need some points to get “stars” in problem solving on hackerrank

1 Like

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 :sweat_smile:. 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. :slight_smile: Thank you for it.

2 Likes