Number Split

Published by Matt in

Given a number, return an array containing the two halves of the number. If the number is odd, make the rightmost number higher.

Examples

number_split(4) ➞ [2, 2]

number_split(10) ➞ [5, 5]

number_split(11) ➞ [5, 6]

number_split(-9) ➞ [-5, -4]

Notes

  • All numbers will be integers.
  • You can expect negative numbers too.
Watch a quick demo on how Edabit works.