MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / pageCount

Function pageCount

Hackerrank_problems/DrawingBook/solution.js:1–6  ·  view source on GitHub ↗
(bookSize, target)

Source from the content-addressed store, hash-verified

1function pageCount(bookSize, target){
2 return Math.min( //pick whichever has the lowest value between
3 Math.floor(target/2)+1, //number of pages from beginning
4 Math.floor((bookSize-target)/2)+1 //number of pages from end
5 )
6}

Callers

nothing calls this directly

Calls 1

minMethod · 0.80

Tested by

no test coverage detected