We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
publicstaticList<Integer>stones(intn,inta,intb){// Write your code hereintbigger=(a>=b)?a:b;intsmaller=(a<=b)?a:b;intdiff=bigger-smaller;intmin=smaller*(n-1);intcurrent=min;List<Integer>lastValues=newArrayList<Integer>();if(diff==0){lastValues.add(current);returnlastValues;}for(inti=0;i<n;i++){//System.out.println(current);lastValues.add(current);current+=diff;
}
return lastValues;
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Manasa and Stones
You are viewing a single comment's thread. Return to all comments →