DigitDegree | CodeFights Intro Algorithm JavaScript Solution and Breakdown
Support our Community:
-Donate:
-Patreon:
-Code, Tech and Caffeine Facebook Group:
-Discord:
– Looking for a a Bootcamp check out DevMountain’s program where housing is included with the tuition:
Tutoring, Mentoring and Course Walkthroughs available:
Thank you to my Patreon Supporters Below:
-Check out youtube.com/user/cardinalslinkyband
Support me and visit my store at:
Internship, Part-Time, & Full time work for college students and recent grads:
Fan funding goes towards buying the equipment necessary to deliver 4k videos, 4k webcam, and a high quality microphone better audio. Any support is very appreciated!
My channel is here for aspiring programmers to learn easier and help debug any issues from the many great free resources available on the web.
Check out my other videos going over HTML, CSS, Ruby, Ruby on Rails, Java, JavaScript, Python, PHP, SQL, Command Line, BootStrap, jQuery, and WordPress from CodeCademy, CodeCombat, FreeCodecamp and more!
-~-~~-~~~-~~-~-
Please watch: “How I Became a Developer | My Developer Journey of the Last 3 Years | Ask a Dev”
-~-~~-~~~-~~-~-
Nguồn:https://cinausp.org/
I would've put if(n<=9) at the beginning of the while loop so you only needed it once. I haven't programmed in a long time so I could be wrong 😋. I love your videos btw
For this problem I suggest creating a function to sum the digits in a given number. Then simply count how many times `digitSum` has to be applied to `n` to get a single digit number.
To sum the digits in a number one could use a mod/div approach.
1. If you mod a base-10 number by 10, you'll get it's first digit. (e.g. 123 % 10 = 3)
2. If you divide a base-10 number by 10, you'll remove it's first digit. (e.g. 123 / 10 = 12.3)
Applying this knowledge you can create a function like `digitSum` I use bellow.
This site needs better QA with their questions. I would have read this once and walked away.
Maybe you should just be starting with the intro. make you look more alive
#Here before David Basil