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.
The AI bros doing L33tCode are heavy now. These 1 liners are ridiculous and help no person. But below hopefully is the logic illustrated by some of the ChatGPT coders.
publicstaticintpageCount(intn,intp){if(p>n)return-1;// early exit, can't be donevarevenPages=n%2==0;// p == begin of book, end of book, or left page end of book if odd pagesif(p==1||n==p||(!evenPages&&p==n-1))return0;elseif(evenPages&&p==n-1)return1;varfromLeftTurns=(int)Math.Floor((decimal)p/2);varfromRightTurns=(int)Math.Floor((decimal)(n-p)/2);returnfromLeftTurns<=fromRightTurns?fromLeftTurns:fromRightTurns;}
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 →
The AI bros doing L33tCode are heavy now. These 1 liners are ridiculous and help no person. But below hopefully is the logic illustrated by some of the ChatGPT coders.