GOOGLE - HAPPY NUMBER (LEETCODE)
This is one of Google's most commonly asked interview questions according to LeetCode (2019)! Happy Number coding solution. If you give me 5 minutes you'll thank me if this appears during your Google interview! Coding Interviews Happy Number (LeetCode) question and explanation.
DISCORD CHANNEL
----------------------------------------------------------------------------------------------------------------
To join the Discord channel use the following link and join the "Member" tier: https://www.patreon.com/KevinNaughtonJr
In this Discord channel, you will be able to...
1. Ask me questions directly (as well as other members)
2. Ask about and discuss previous interview experiences
3. Find mock interview partners
4. Share helpful videos for interview preparation, and more!
This question is commonly asked by the following companies: Google, Facebook, Apple, JPMorgan, VMWare, and Nutanix.
Link to problem: https://leetcode.com/problems/happy-number/
Intuition behind solution: while our number is not a happy number (n != 1) we continue summing the squares of the digits of n. To do this we store the current value of n and while it is not equal to zero we grab the last number of current (current % 10), multiply it by itself and add it to our sum. Once we have iterated through all the digits of current, we check if our new sum is already contained in our "seen" hashset, if it is, we return false (this means we are in a cycle). Otherwise, we add the current sum to our "seen" hash set and set our n to our new sum. If our outer loop ever breaks, we return true.
SOCIAL
----------------------------------------------------------------------------------------------------------------
Support me on Patreon: https://www.patreon.com/KevinNaughtonJr
Follow me on Twitter: https://twitter.com/KevinNaughtonJr
Follow me on Instagram: https://instagram.com/kevinnaughtonjr/
Follow me on GitHub: https://github.com/kdn251
MUSIC
----------------------------------------------------------------------------------------------------------------
Leave Em Cold by @lau_mcgill
https://soundcloud.com/laurentiusmcgill/leave-em-cold
#coding #interviews #softwareengineering
Видео GOOGLE - HAPPY NUMBER (LEETCODE) канала Kevin Naughton Jr.
DISCORD CHANNEL
----------------------------------------------------------------------------------------------------------------
To join the Discord channel use the following link and join the "Member" tier: https://www.patreon.com/KevinNaughtonJr
In this Discord channel, you will be able to...
1. Ask me questions directly (as well as other members)
2. Ask about and discuss previous interview experiences
3. Find mock interview partners
4. Share helpful videos for interview preparation, and more!
This question is commonly asked by the following companies: Google, Facebook, Apple, JPMorgan, VMWare, and Nutanix.
Link to problem: https://leetcode.com/problems/happy-number/
Intuition behind solution: while our number is not a happy number (n != 1) we continue summing the squares of the digits of n. To do this we store the current value of n and while it is not equal to zero we grab the last number of current (current % 10), multiply it by itself and add it to our sum. Once we have iterated through all the digits of current, we check if our new sum is already contained in our "seen" hashset, if it is, we return false (this means we are in a cycle). Otherwise, we add the current sum to our "seen" hash set and set our n to our new sum. If our outer loop ever breaks, we return true.
SOCIAL
----------------------------------------------------------------------------------------------------------------
Support me on Patreon: https://www.patreon.com/KevinNaughtonJr
Follow me on Twitter: https://twitter.com/KevinNaughtonJr
Follow me on Instagram: https://instagram.com/kevinnaughtonjr/
Follow me on GitHub: https://github.com/kdn251
MUSIC
----------------------------------------------------------------------------------------------------------------
Leave Em Cold by @lau_mcgill
https://soundcloud.com/laurentiusmcgill/leave-em-cold
#coding #interviews #softwareengineering
Видео GOOGLE - HAPPY NUMBER (LEETCODE) канала Kevin Naughton Jr.
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
![GOOGLE - VALID MOUNTAIN ARRAY (LeetCode)](https://i.ytimg.com/vi/WWysBX-N2Ak/default.jpg)
![GOOGLE CODING INTERVIEW QUESTION - SHORTEST WAY TO FORM STRING](https://i.ytimg.com/vi/evesA3gr9BE/default.jpg)
![What no one tells you about coding interviews (why leetcode doesn't work)](https://i.ytimg.com/vi/LQFsEwcCO1E/default.jpg)
![Happy number | Leetcode](https://i.ytimg.com/vi/Egw03gI-Tf0/default.jpg)
![Happy Number - Leetcode 202 - Python](https://i.ytimg.com/vi/ljz85bxOYJ0/default.jpg)
![LEETCODE 202 (JAVASCRIPT) | HAPPY NUMBER](https://i.ytimg.com/vi/CUoAon6Ef-g/default.jpg)
![](https://i.ytimg.com/vi/xgeMX9LNnYM/default.jpg)
![How To Solve LeetCode Happy Number | Understanding Algorithms](https://i.ytimg.com/vi/vIQY1k0vyGo/default.jpg)
![AMAZON - GROUPED ANAGRAMS (LeetCode)](https://i.ytimg.com/vi/ptgykfAEax8/default.jpg)
![LeetCode #202: Happy Number | Facebook Interview Question | C++](https://i.ytimg.com/vi/EQM7Ylkv7AE/default.jpg)
![5 must have skills to become a programmer (that you didn't know)](https://i.ytimg.com/vi/3MtrUf81k6c/default.jpg)
![FACEBOOK CODING INTERVIEW QUESTION - DECODE WAYS (LeetCode)](https://i.ytimg.com/vi/cQX3yHS0cLo/default.jpg)
![GOOGLE CODING INTERVIEW QUESTION - BAG OF TOKENS](https://i.ytimg.com/vi/1GubKefOabc/default.jpg)
![GOOGLE PHONE INTERVIEW QUESTION - LARGEST VALUES FROM LABELS](https://i.ytimg.com/vi/84xibeO_lqk/default.jpg)
![Is A LeetCode Premium Subscription Worth It?](https://i.ytimg.com/vi/ppySJa44sT8/default.jpg)
![AMAZON CODING INTERVIEW QUESTION - COIN CHANGE (LeetCode)](https://i.ytimg.com/vi/1R0_7HqNaW0/default.jpg)
![Happy Number Javascript 202 Leetcode | Google Interview question](https://i.ytimg.com/vi/b0PC0-NRCxw/default.jpg)
![GOOGLE CODING INTERVIEW QUESTION - CLIMBING STAIRS (LeetCode)](https://i.ytimg.com/vi/uHAToNgAPaM/default.jpg)
![FACEBOOK - VALID PALINDROME II (LeetCode)](https://i.ytimg.com/vi/L_74qbyPHXE/default.jpg)
![Cycle Sort - Amazon, Google, Microsoft Interview Questions](https://i.ytimg.com/vi/JfinxytTYFQ/default.jpg)