Last active
February 12, 2018 21:50
-
-
Save thomasvaeth/0740360813ca950aee3b2a70a9c69839 to your computer and use it in GitHub Desktop.
"Opportunities lie in the place where the complaints are." - Jack Ma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function seatsInTheater(numCols, numRows, myCol, myRow) { | |
var calcCols = myCol > numCols / 2 ? numCols - myCol + 1 : myCol, | |
unblocked = ((numCols - calcCols) * numRows) + ((myRow - 1) * calcCols); | |
return numCols * numRows - unblocked - 1; | |
} | |
seatsInTheater(16, 11, 5, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment