Can somebody please explain why both of these solutions for problem MSNG are not working

Please Help,
I brainstormed a lot but couldnt find where it fails. Looks like the same error on both the codes.
PS. the approach used in both the codes is different

Similar to your’s.

Hi @ashish_arora , What do you think should be the output for the the test case below?
-1 10000
-1 121
There are two possibilities, 16 and 256 . Your code is giving the output 256. Is it mentioned anywhere about what is the accepted answer if multiple answers are possible as above?
Even I have problem with the acceptance of the same problem. Please help me with it .

@ashish_arora Hi, it is there in the problem statement " Your task is to find the smallest common number XX that satisfies all conditions, or determine that no such common number exists." . So it should return 16 this does return 16

Answer should be 16 as it was minimum when compared b/w 16 and 256

I am also stuck

yes, it does return 16

Dude, I got you
Consider Testcase :
-1 000(any no of zeros)(except 1 zero)
ans has to be zero.
Your code(both of them) is printing -1.

can someone help me to find out where my solution is failing for 2nd subtask:
my solution can be seen at.


-1 Z0000000000000

test case gives answer as “False”. i think it should be -1

It is said in the comments section that redundant zeroes are not present in test cases

oh i see,[20 char limit]

Multiple zeroes is probably not a valid test case

I even read the editorial but still cannot figure out where it is failing.

For some of the cases its printing false instead of -1

still getting WA

Can You explain me your code?

Which Of the two approaches do you want me to explain to you !?

the first link