avatar Bite 270. Most frequent digit in number

Given an integer number, find the most frequent digit in it.

Examples:

  • 1998 -> two 9's, one 1, one 8 so return 9
  • 177 -> return 7
  • 2020 -> there is 2 two's, 2 zero's. Return 2 = the first highest hitter
  • 12345 -> all digits occur once, so like the last example return the first digit = 1

Food for thought: how to count things efficiently?

Have fun and keep calm and code in Python!

Login and get coding
go back Beginner level
Bitecoin 2X

492 out of 522 users completed this Bite.
Will you be the 493rd person to crack this Bite?
Resolution time: ~33 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 3.0 on a 1-10 difficulty scale.
» You can do it! 😌

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help