You are viewing a single comment's thread. Return to all comments →
Go version O(1)
func pageCount(n int32, p int32) int32 { if n / 2 >= p { return p/2 } else { pagesToFlip := (n - p) / 2 if n % 2 == 0 && n - p == 1 { pagesToFlip++ } return pagesToFlip } }
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 →
Go version O(1)