Is the Number a Repdigit

Published by Matt in

A repdigit is a positive number composed out of the same digit. Create a function that takes an integer and returns whether it's a repdigit or not.

Examples

is_repdigit(66) ➞ true

is_repdigit(0) ➞ true

is_repdigit(-11) ➞ false

Notes

  • The number 0 should return true (even though it's not a positive number).
  • Check the Resources tab for more info on repdigits.
Watch a quick demo on how Edabit works.