Here I am not able to understand the meaning of equivalent in this question
What i am understanding is that they are equal but with this approach 1 case is giving wrong answer
Here I am not able to understand the meaning of equivalent in this question
What i am understanding is that they are equal but with this approach 1 case is giving wrong answer
hi gagan,
Your code is not working on this test case:
1
abcd
badc
First try to think for some time, if you dont figure it out.
I will give you the solution, because its the only way to improve.
Hi thanx for replying my doubt was what exactly does equivalent mean in this problem
hi gagan,
In test case
abcd
badc
firstly we will break abcd and badc
ab cd
ba dc
Now break ab and ba
a b
b a
Now break cd and dc
c d
d c
As now you can see
a1 is equivalent b2
and b2 is equivalent to a1 in each case.
Hope this helps,still if you have doubt let me know i will explain you over google meet.
Now i get it thanx i have tried recursion here but it is failing to pass test case in codeforces possibly due to the constraint
MY CODE=>https://ide.codingblocks.com/s/320266 CODEFORCES QUES LINK =>https://codeforces.com/problemset/problem/559/B
yes gagan,
It is a good question with those constraints and requires hashing along with divide and conquer.
Your logic and coode is completely right.
alright i will think to implement using hashing . Thanx for help abhishek