Given dimensions of a 2D array, except 1xn, that results in an odd number of elements, find the midpoint index.
Example: Input is 3x5, representing the 2D array
[0,0] [0,1] [0,2] [0,3] [0,4]
[1,0] [1,1] [1,2] [1,3] [1,4]
[2,0] [2,1] [2,2] [2,3] [2,4]
The midpoint index is [1,2]
Input
3
5
Output
1 , 2
Rules
- Standard code-golf rules, fewest bytes wins
- Either full program or function is permitted
- When input is either 1xn or the corresponding array would have an even number of elements, output must be [0,0]
- nx1 should be treated like any other array
output must be [0,0]
any reason behind that? How does that part add anything to computing the midpoint? Obviously, 1xn arrays or arrays with an even dimension don't have[0,0]
as their midpoints. \$\endgroup\$