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.
publicstaticintpageCount(intn,intp){intfront=p/2;intback=(n-p)/2;//This handles an edge case where we want //the formula above to actually be 1 (not 0)//when n is even and p is one less than nif(n-p==1&&n%2==0)back++;if(front<back){returnfront;}else{returnback;}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Drawing Book
You are viewing a single comment's thread. Return to all comments →
Java