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){inttotalFlips=n/2;intfromStart=0;intfromEnd=0;/* Generalize to even page count. like 0, 2, 4, 6, 8...... */p=p%2==0?p:p-1;fromStart=p/2;fromEnd=totalFlips-fromStart;returnfromStart>=fromEnd?fromEnd:fromStart;}
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 →
C#