Maximum-tip-calculator

https://practice.geeksforgeeks.org/problems/maximum-tip-calculator/0

plz correct my code it is showing wrong ans on sample test cases also
explain the changes made by u in my code…

Try to think of greedy solution as ur code will exceed time limit. Sort the array in decreasing order according to their abs differences and add then add the highest tip of the two to the ans.

No time limit will be taken care of after …
Problem is that
My code is running fine for sample test case 2 in ques but showing wrong ans that is the problem …
Correct my code so that it shows correct and for sample test case 2…in ques …as I think it should show the correct ans…

Plz reply at the earliest

Plz reply at the earliest it’s already been days

why are u not replying???

u are returning 0 if(x==0 || y==0). But u should return something else.Try to think!!

yes we should return 0 because now we cant take anything from the x related array and then we will only have y related array left…

plz reply

why arent u replying??make change if necessary …and explain

why arent u replying ?? plz reply
its been 4 days and u havent solved my doubt …plz do it now

Try this:

But what is problem in my code
plz make changes in my code
what should I return in my code when x==0??or y=0 plz tell

if x==0 then go for all values of y else if y==0 go for all values of x

How to code it??..

Plz solve thuis problem as well no one has replied to it …
It’s been 4 days already

Already given the code for x==0 y==0 condition discussed above.