FEB19 HMAPPY2 Wrong Logic Gives AC (100/100)!

1.Wrong Logic Without LCM Still 100/100 !!

2.Right Logic With LCM 100/100 !!

This Solution contains wrong logic still it gives 100/100

This Solution only gives perfect answer when they give input A & B as the LCM(A,B) is A or B only.else it’s wrong u can check that.

The Hidden test case files only contains that input in which LCM(A,B) is A or B… so Test Cases are not considering all conditions…

Even The Example Test case is not in that test case file !! Because this solution gives wrong answer in that example test case also !!! still it gives AC(100/100) !!!

1 Like

Yeah it’s observable
6 2 3 3 then 6/2=3 and 6/3=2 , lcm(2,3)=6 therefore 6/6=1 and 2*1=2
so final solution is 3+2-2=3 and 3>=3 hence ‘Win’

according to your logic:- 6/2=3 and 6/3=2 then |3-2|=1 and 1<3 hence it’s 'Lose
then this should be a wrong answer.

yeah you are right the hidden test cases only have LCM(a,b) == a or b

that’s why his solution worked

I think that ideal solution should be after considering the LCM of a,b

see these two solutions of mine :

  1. wrong answer when I didn’t consider LCM

  2. AC when LCM is considered

Seems like question has weak test cases. The accepted solution without LCM should be WA.