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.
// return negative number if not found
// otherwise pivot is returned.
// caller can print 5 x pivot + 3 x (n-pivot)
int getPivot(int n) {
while(n > 0) {
if(n%3 == 0)
break;
else
n -= 5;
}
return n;
}
Sherlock and The Beast
You are viewing a single comment's thread. Return to all comments →
This function works quicker than of editorial.
So you can do this: