Add Digits | LeetCode 258 | C++, Java, Python3 | O(1)

  Рет қаралды 5,733

Knowledge Center

Knowledge Center

4 жыл бұрын

****** At 13:50, I said if n%9 == 0 return 9, but mistakingly wrote 0.
LeetCode Solutions: • LeetCode Solutions | L...
June LeetCoding Challenge: • Playlist
May LeetCoding Challenge: • Playlist
Github Link: github.com/KnowledgeCenterYou...
*** Best Books For Data Structures & Algorithms for Interviews:*********
1. Cracking the Coding Interview: amzn.to/2WeO3eO
2. Cracking the Coding Interview Paperback: amzn.to/3aSSe3Q
3. Coding Interview Questions - Narasimha Karumanchi: amzn.to/3cYqjkV
4. Data Structures and Algorithms Made Easy - N. Karumanchi: amzn.to/2U8FrDt
5. Data Structures & Algorithms made Easy in Java - N. Karumanchi: amzn.to/2U0qZgY
6. Introduction to Algorithms - CLR - Cormen, Leiserson, Rivest: amzn.to/2Wdp8rZ
*****************************************************************************
July LeetCoding Challenge | Problem 26 | Add Digits | 26 July,
Facebook Coding Interview question,
google coding interview question,
leetcode,
Add Digits,
Add Digits c++,
Add Digits Java,
Add Digits python,
Add Digits solution,
258. Add Digits
#CodingInterview #LeetCode #JulyLeetCodingChallenge #Google #Amazon #AddDigits

Пікірлер: 24
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
At 13:50, I said if n%9 == 0 return 9, but mistakingly wrote 0.
@raiyan22
@raiyan22 4 жыл бұрын
very clear explanation, helped me understand the concept thank you
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Great to hear!
@mohammadyahya78
@mohammadyahya78 2 жыл бұрын
You are the best in this area so far. Thank you.
@KnowledgeCenter
@KnowledgeCenter 2 жыл бұрын
Wow, thank you!
@surajbaranwal56.
@surajbaranwal56. 2 жыл бұрын
may god bless you with more enlightenment, to teach such easily, and confidently. Good job man.
@KnowledgeCenter
@KnowledgeCenter 2 жыл бұрын
Thanks, you too!
@AlokKumar-jh8wp
@AlokKumar-jh8wp 4 жыл бұрын
Thankyou sir for the explanation. It was nice crisp and clear
@PiBiNi
@PiBiNi 4 жыл бұрын
Great work! I like all your videos... Keep it coming
@praveenj3112
@praveenj3112 4 жыл бұрын
Thanks you for your great explanation
@Mr_SSK
@Mr_SSK 2 жыл бұрын
Thank you so much! Nicely explained! :)
@KnowledgeCenter
@KnowledgeCenter 2 жыл бұрын
Glad it was helpful!
@sanjana8267
@sanjana8267 2 жыл бұрын
Thank you so much for explaining this!!!!!
@KnowledgeCenter
@KnowledgeCenter 2 жыл бұрын
You're so welcome!
@chetanshrivastava3762
@chetanshrivastava3762 3 жыл бұрын
Very nice explanation.God bless you..
@KnowledgeCenter
@KnowledgeCenter 3 жыл бұрын
Thanks a lot
@reshubnigam8375
@reshubnigam8375 4 жыл бұрын
Hi, just wanted to know for questions like these, do you actually work out the math and then derive the intuition and algorithm? Or is it just lots of practice and a first encounter? After which we can solve because we had seen this or similar one earlier. Thank You!
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Here output is always between 1-9 (except 0, fro n=0), irrespective of how large the number is. So, In many problems like this and some oft the problems relating to Bit arithmetic, I always try to write a few examples, and see if there is any pattern. If you had written examples for 1st 20-25 numbers you would notice that It always keeps repeating in same order: 1,2,..9, 1,2...,9, 1..9.. After you find that there is a pattern, then you should try to reason out, why is this Pattern, and back it up with underlying math. I have seen similar Example Approach to find pattern and Generalize for a few Bit arithmetic problems as well.
@rahul-patil
@rahul-patil 3 жыл бұрын
You are awesome!
@KnowledgeCenter
@KnowledgeCenter 3 жыл бұрын
Thanks.
@gouravgoel2974
@gouravgoel2974 4 жыл бұрын
sir, from where can we practice these type of questions I am good at solving algorithmic problems, from where can I practice maths related questions....thanks a lot for all your efforts
@gouravgoel2974
@gouravgoel2974 3 жыл бұрын
@@anonymousasdoasidjasd9911 thanks
@65chass
@65chass 4 жыл бұрын
I have a question for which I have not been able to get a proper explanation and code example. Please help me out. The Problem Statement: There are some number of candidates who are to be voted. All the voters will vote in a preferential order. example: if the candidates are A,B,C then the Votes can be as follows: ABC BCA CBA BAC and so on...we need to find the final order in which the candidates are to be arranged. In this example like for the first position B has the maximum number of votes then B takes the first position. In case there are 2 or more than two candidates who tie for a particular position then we go on and check which one of them got the cumulative highest and then so on till one candidate wins. if till end they have a tie then they are to be arranged in a lexicographic order. I think this is the kemeny-young algorithm of preferential voting but I could not get a proper document or video explaining this algorithm. @knowledgeCentre please help me out with this problem.
@haaarshiiiit
@haaarshiiiit 4 жыл бұрын
Please make a video on this Binary Search question - leetcode.com/problems/find-k-closest-elements/
Reverse Nodes in k-Group | LeetCode 25 | C++ 🕵️‍♂️🔥
27:35
Knowledge Center
Рет қаралды 13 М.
Excel Sheet Column Number | LeetCode 171 | C++, Java, Python
7:07
Knowledge Center
Рет қаралды 30 М.
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 22 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 73 МЛН
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 126 МЛН
Leetcode - Add Digits (Math Explained)
5:32
Timothy H Chang
Рет қаралды 923
Median of two Sorted Arrays | Leetcode 4 | C++
35:58
Knowledge Center
Рет қаралды 7 М.
The Black Box Method: How to Learn Hard Concepts Quickly
14:09
Colin Galen
Рет қаралды 1,1 МЛН
FACEBOOK CODING QUESTION - ADD STRINGS (LEETCODE)
12:23
AlgosWithMichael
Рет қаралды 11 М.
Genetic Algorithms Explained By Example
11:52
Kie Codes
Рет қаралды 317 М.
Linear Search Algorithm - Theory + Code + Questions
1:15:44
Kunal Kushwaha
Рет қаралды 726 М.
Add Digits | LeetCode problem 258
5:40
Technosage
Рет қаралды 3,8 М.
Multithreading In C++
18:10
CppNuts
Рет қаралды 185 М.
How to Start Leetcode in 2024 (as a beginner)
8:45
Ashish Pratap Singh
Рет қаралды 751 М.
Solve Any Pattern Question With This Trick!
57:20
Kunal Kushwaha
Рет қаралды 2,3 МЛН
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 22 МЛН