during my submission it is showing wrong answer

import java.util.;
import java.io.
;
import java.lang.*;
class gold_coins
{
public static void main(String args[])
{
Scanner I=new Scanner(System.in);
long t=I.nextLong();
while(t–>0)
{
long n=I.nextInt();
gold_coins ob =new gold_coins();
long r=ob.coins(n);
System.out.println®;
}
}
long m;
public long coins(long n)
{
if(n==0)
return 0;
else if(n<12)
return n;
else
m = Math.max(n,coins(n/2)+coins(n/3)+coins(n/4));
return m;
}
}

Kindly post your solution in this style by clicking symbol 101 in the editor or by placing a backtick(`) at the beginning and end of your code , which is positioned above tab button on your keyboard. This reply is generated since you asking a human and not a complier . post a link of your question , you are solving ?

1 Like

Here is the link to the problem. I solved it using Dynamic programming and HashMap. Here is the link to my code.

//