Uploaded January 2020 | Updated December 2026, 1 day ago
In this video, we will learn head recursion, tail recursion and head vs tail recursion with example.
recursion basics with examples: youtu.be/Sf-LR7OI-Ww
python Tutor Tutorial link: youtu.be/TRMKJucB3B8
recursion visualization: youtu.be/AIwxbJ5mP8M
In this video, I will be covering Head recursion then Tail recursion then Head vs tail recursion after that we will see a Demo And at the end we will do a quick quiz? Head recursion A function is called head recursive if recursive call is made before it performs its own task and this process is known as head recursion. Letβs try to understand this with the help of an example The problem statement is, given an integer n, print the sequence of integer. So, here is the algorithm to do the same. Letβs take input is 5. will go through the code and try to visualize the stack frame, execution flow and console output. So, this is output bar which will display the output so far, this is stack frame which will help us to see the current method execution call. and this window will help us to visualize our recursive algorithm flow. Guys, in this window whatever you will see it will be the internal state of this method which I am printing here, it is just for visualization purpose to make you understand how it works internally. If you want to know on which basis this execution flow is getting printed here, so let me tell you just by adding couple of console output statement in this code will get you this. In demo section, we will see this practically. So letβs start our visualization. As we know, main method is the first one which will be invoked when program execution starts, so I have put that method first into the stack. Now main() method will call this function headRec(5) Letβs see the current state of the execution Main() method call execution is put on hold for some time and until headRec(5) method will return. Here n=5, so if condition is false, it will go to the else block. now it will call itself headRec(4) by reducing the n value by 1.
π΄ DONT CLICK THIS: bit.ly/2G4cEuc
π Like us on Facebook: facebook.com/javaaid
πShare this video with your friend: youtu.be/lG6HxO7cDRw
β Join our community βΊ
π Coding interview preparation group: facebook.com/groups/codingip
π Telegram link for algorithmic tutorial: https://t.me/javaaid
π Telegram link for hackerrank solutions: https://t.me/hackerranksolutions
β Recommended playlists βΊ
π Dynamic Programming Tutorial For Beginner: youtube.com/watch?v=ewXklhesC-w&list=PLSIpQf0NbcClDpWE58Y-oSJro_W3LO8Nb
π New To JAVAAID ? Watch These Videos: youtube.com/watch?v=pVS3yhlzrlQ&list=PLSIpQf0NbcClvBksfrr_jOpZCraiog3-J
π Algorithms Fundamental: youtube.com/playlist?list=PLSIpQf0NbcCk2O05hkxHPtVqGRGtnClh8
π Coding Interview Questions: youtube.com/playlist?list=PLSIpQf0NbcCm1HjcbM6aAoDUdpZyS1YBP
π All hackerrank solutions: youtube.com/watch?v=oz_yowFTrgs&list=PLSIpQf0NbcCltzNFrOJkQ4J4AAjW3TSmA
π TOP 10 LEARNING RESOURCES
1) Cracking the Coding Interview :amzn.to/30HFJCE
2) Algorithms Hardcover :amzn.to/30Hjdd9
3) The Algorithm Design Manual :amzn.to/2AEtEDL
4) Data Structures & Algorithms in Java :amzn.to/2AG82ag
5) Data Structures and Algorithms Made Easy :amzn.to/2M8UvNK
6) Grokking Algorithms :amzn.to/2LKu8yD
7) Dynamic Programming for Coding Interviews :amzn.to/2AC7BO9
8) Introduction to Algorithms :amzn.to/2oSJAzq
9) Elements of Programming Interviews in Java :amzn.to/30MBjKO
10) Programming Interviews Exposed :amzn.to/2V8mFfO
π Letβs Connect βΊ
Facebook: facebook.com/coolkanahaiya
Instagram: instagram.com/javaaid.algorithms
Git Hub: github.com/kanahaiya
Twitter: twitter.com/Kanahaiyagupta
Linked in: linkedin.com/in/kanahaiya-gupta
#JAVAAID #headrecursion #tailrecursion #headvstailrecursion #leetcode #javaAidTutorials #programming #recursion-basics #recursion-tutorial #algorithms #coding #competitiveprogramming #google #java #problemsolving #kanahaiyaGupta
DISCLAIMER: These above-mentioned resources have affiliate links, which means if you buy one of the products from my links, I might receive a small commission without having an extra cost to you. This helps support the channel and allows us to continue to add more tutorial. Thank you for your support!
NOTE: All above-shared learning resources are best of my knowledge as I have personally read all except one Introduction to Algorithms.
In this video, we will learn head recursion, tail recursion and head vs tail recursion with example.
recursion basics with examples: youtu.be/Sf-LR7OI-Ww
python Tutor Tutorial link: youtu.be/TRMKJucB3B8
recursion visualization: youtu.be/AIwxbJ5mP8M
In this video, I will be covering Head recursion then Tail recursion then Head vs tail recursion after that we will see a Demo And at the end we will do a quick quiz? Head recursion A function is called head recursive if recursive call is made before it performs its own task and this process is known as head recursion. Letβs try to understand this with the help of an example The problem statement is, given an integer n, print the sequence of integer. So, here is the algorithm to do the same. Letβs take input is 5. will go through the code and try to visualize the stack frame, execution flow and console output. So, this is output bar which will display the output so far, this is stack frame which will help us to see the current method execution call. and this window will help us to visualize our recursive algorithm flow. Guys, in this window whatever you will see it will be the internal state of this method which I am printing here, it is just for visualization purpose to make you understand how it works internally. If you want to know on which basis this execution flow is getting printed here, so let me tell you just by adding couple of console output statement in this code will get you this. In demo section, we will see this practically. So letβs start our visualization. As we know, main method is the first one which will be invoked when program execution starts, so I have put that method first into the stack. Now main() method will call this function headRec(5) Letβs see the current state of the execution Main() method call execution is put on hold for some time and until headRec(5) method will return. Here n=5, so if condition is false, it will go to the else block. now it will call itself headRec(4) by reducing the n value by 1.
π΄ DONT CLICK THIS: bit.ly/2G4cEuc
π Like us on Facebook: facebook.com/javaaid
πShare this video with your friend: youtu.be/lG6HxO7cDRw
β Join our community βΊ
π Coding interview preparation group: facebook.com/groups/codingip
π Telegram link for algorithmic tutorial: https://t.me/javaaid
π Telegram link for hackerrank solutions: https://t.me/hackerranksolutions
β Recommended playlists βΊ
π Dynamic Programming Tutorial For Beginner: youtube.com/watch?v=ewXklhesC-w&list=PLSIpQf0NbcClDpWE58Y-oSJro_W3LO8Nb
π New To JAVAAID ? Watch These Videos: youtube.com/watch?v=pVS3yhlzrlQ&list=PLSIpQf0NbcClvBksfrr_jOpZCraiog3-J
π Algorithms Fundamental: youtube.com/playlist?list=PLSIpQf0NbcCk2O05hkxHPtVqGRGtnClh8
π Coding Interview Questions: youtube.com/playlist?list=PLSIpQf0NbcCm1HjcbM6aAoDUdpZyS1YBP
π All hackerrank solutions: youtube.com/watch?v=oz_yowFTrgs&list=PLSIpQf0NbcCltzNFrOJkQ4J4AAjW3TSmA
π TOP 10 LEARNING RESOURCES
1) Cracking the Coding Interview :amzn.to/30HFJCE
2) Algorithms Hardcover :amzn.to/30Hjdd9
3) The Algorithm Design Manual :amzn.to/2AEtEDL
4) Data Structures & Algorithms in Java :amzn.to/2AG82ag
5) Data Structures and Algorithms Made Easy :amzn.to/2M8UvNK
6) Grokking Algorithms :amzn.to/2LKu8yD
7) Dynamic Programming for Coding Interviews :amzn.to/2AC7BO9
8) Introduction to Algorithms :amzn.to/2oSJAzq
9) Elements of Programming Interviews in Java :amzn.to/30MBjKO
10) Programming Interviews Exposed :amzn.to/2V8mFfO
π Letβs Connect βΊ
Facebook: facebook.com/coolkanahaiya
Instagram: instagram.com/javaaid.algorithms
Git Hub: github.com/kanahaiya
Twitter: twitter.com/Kanahaiyagupta
Linked in: linkedin.com/in/kanahaiya-gupta
#JAVAAID #headrecursion #tailrecursion #headvstailrecursion #leetcode #javaAidTutorials #programming #recursion-basics #recursion-tutorial #algorithms #coding #competitiveprogramming #google #java #problemsolving #kanahaiyaGupta
DISCLAIMER: These above-mentioned resources have affiliate links, which means if you buy one of the products from my links, I might receive a small commission without having an extra cost to you. This helps support the channel and allows us to continue to add more tutorial. Thank you for your support!
NOTE: All above-shared learning resources are best of my knowledge as I have personally read all except one Introduction to Algorithms.


![Triple sum Hackerrank Solution O(nlogn) | Interview Preparation Kit
triple sum hackerrank solution: In this video, I have solved hackerrank triple sum problem in optimize way.
This hackerrank problem is a part of Practice | Interview Preparation Kit| Search| Triple sum hackerrank challenge.
For simplicity, I have divided this hackerrank tutorial into 3 parts.
[00:00] Understanding the problem statement.
[05:08] Building the logic to solve the problem.
[18:10] Coding the logic using java (you can use your own preferred programming language).
π΄ DONT CLICK THIS: https://bit.ly/2G4cEuc
π Like us on Facebook: https://www.facebook.com/HackerRankSolutionTutorials
πShare this video with your friend: https://youtu.be/pVkHLciuank
β Join our community βΊ
π Coding interview preparation group: https://www.facebook.com/groups/codingip
π Telegram link for algorithmic tutorial: https://t.me/javaaid
π Telegram link for hackerrank solutions: https://t.me/hackerranksolutions
π Resources βΊ
π Problem statement: https://www.hackerrank.com/challenges/triple-sum/problem
π‘ Source code: https://github.com/Java-aid/Hackerrank-Solutions/blob/master/HackerRankDashboard/Interview-Preparation-Kit/src/main/java/com/javaaid/search/TripleSum.java
β
Recommended playlists βΊ
π All hackerrank solutions: https://www.youtube.com/watch?v=oz_yowFTrgs&list=PLSIpQf0NbcCltzNFrOJkQ4J4AAjW3TSmA
π New To JAVAAID ? Watch These Videos: https://www.youtube.com/watch?v=pVS3yhlzrlQ&list=PLSIpQf0NbcClvBksfrr_jOpZCraiog3-J
π Algorithms Fundamental: https://www.youtube.com/playlist?list=PLSIpQf0NbcCk2O05hkxHPtVqGRGtnClh8
π Coding Interview Questions: https://www.youtube.com/playlist?list=PLSIpQf0NbcCm1HjcbM6aAoDUdpZyS1YBP
π Dynamic Programming Tutorial For Beginner: https://www.youtube.com/watch?v=ewXklhesC-w&list=PLSIpQf0NbcClDpWE58Y-oSJro_W3LO8Nb
π TOP 10 LEARNING RESOURCES
1) Cracking the Coding Interview :https://amzn.to/30HFJCE
2) Algorithms Hardcover :https://amzn.to/30Hjdd9
3) The Algorithm Design Manual :https://amzn.to/2AEtEDL
4) Data Structures & Algorithms in Java :https://amzn.to/2AG82ag
5) Data Structures and Algorithms Made Easy :https://amzn.to/2M8UvNK
6) Grokking Algorithms :https://amzn.to/2LKu8yD
7) Dynamic Programming for Coding Interviews :https://amzn.to/2AC7BO9
8) Introduction to Algorithms :https://amzn.to/2oSJAzq
9) Elements of Programming Interviews in Java :https://amzn.to/30MBjKO
10) Programming Interviews Exposed :https://amzn.to/2V8mFfO
π Letβs Connect βΊ
Git Hub: https://github.com/kanahaiya
Twitter: https://twitter.com/Kanahaiyagupta
Linked in: https://www.linkedin.com/in/kanahaiya-gupta
Facebook: https://www.facebook.com/coolkanahaiya
Instagram: https://www.instagram.com/coolkanahaiya
#JAVAAID #triplesum #HackerRankSolutions #interview-preparation-kit #HackerRank #JavaAidTutorials #programming #DataStructures #algorithms #coding #competitiveprogramming #java #codinginterview #problemsolving #KanahaiyaGupta #hackerrankchallenges Triple sum Hackerrank Solution O(nlogn) | Interview Preparation Kit](https://i.ytimg.com/vi/pVkHLciuank/mqdefault.jpg)
![Separate the Numbers HackerRank Solution
separate the Numbers hackerrank solution : In this video, I have solved hackerrank Separate the Numbers problem in an easy way.
This hackerrank problem is a part of Practice | Algorithms | Strings | Separate the Numbers hackerrank challenge.
For simplicity, I have divided this hackerrank tutorial into 3 parts.
[00:00] Understanding the problem statement.
[07:31] Building the logic to solve the problem.
[17:04] Coding the logic using java (you can use your own preferred programming language).
π΄ DONT CLICK THIS: https://bit.ly/2G4cEuc
π Like us on Facebook: https://www.facebook.com/HackerRankSolutionTutorials
πShare this video with your friend: https://youtu.be/q9d7MZpuWSE
β Join our community βΊ
π Coding interview preparation group: https://www.facebook.com/groups/codingip
π Telegram link for algorithmic tutorial: https://t.me/javaaid
π Telegram link for hackerrank solutions: https://t.me/hackerranksolutions
π Resources βΊ
π Problem statement: https://www.hackerrank.com/challenges/separate-the-numbers/problem
π‘ Source code: https://github.com/Java-aid/Hackerrank-Solutions/blob/master/HackerRankDashboard/CoreCS/Algorithms/src/main/java/com/javaaid/hackerrank/solutions/algorithms/strings/SeparateTheNumbers.java
β
Recommended playlists βΊ
π All hackerrank solutions: https://www.youtube.com/watch?v=oz_yowFTrgs&list=PLSIpQf0NbcCltzNFrOJkQ4J4AAjW3TSmA
π New To JAVAAID ? Watch These Videos: https://www.youtube.com/watch?v=pVS3yhlzrlQ&list=PLSIpQf0NbcClvBksfrr_jOpZCraiog3-J
π Algorithms Fundamental: https://www.youtube.com/playlist?list=PLSIpQf0NbcCk2O05hkxHPtVqGRGtnClh8
π Coding Interview Questions: https://www.youtube.com/playlist?list=PLSIpQf0NbcCm1HjcbM6aAoDUdpZyS1YBP
π Dynamic Programming Tutorial For Beginner: https://www.youtube.com/watch?v=ewXklhesC-w&list=PLSIpQf0NbcClDpWE58Y-oSJro_W3LO8Nb
π TOP 10 LEARNING RESOURCES
1) Cracking the Coding Interview :https://amzn.to/30HFJCE
2) Algorithms Hardcover :https://amzn.to/30Hjdd9
3) The Algorithm Design Manual :https://amzn.to/2AEtEDL
4) Data Structures & Algorithms in Java :https://amzn.to/2AG82ag
5) Data Structures and Algorithms Made Easy :https://amzn.to/2M8UvNK
6) Grokking Algorithms :https://amzn.to/2LKu8yD
7) Dynamic Programming for Coding Interviews :https://amzn.to/2AC7BO9
8) Introduction to Algorithms :https://amzn.to/2oSJAzq
9) Elements of Programming Interviews in Java :https://amzn.to/30MBjKO
10) Programming Interviews Exposed :https://amzn.to/2V8mFfO
π Letβs Connect βΊ
Git Hub: https://github.com/kanahaiya
Twitter: https://twitter.com/Kanahaiyagupta
Linked in: https://www.linkedin.com/in/kanahaiya-gupta
Facebook: https://www.facebook.com/coolkanahaiya
Instagram: https://www.instagram.com/coolkanahaiya
#JAVAAID #separatethenumbers #HackerRankSolutions #HackerRankTutorials #HackerRank #JavaAidTutorials #programming #DataStructures #algorithms #coding #competitiveprogramming #java #codinginterview #problemsolving #KanahaiyaGupta #hackerrankchallenges #strings Separate the Numbers HackerRank Solution](https://i.ytimg.com/vi/q9d7MZpuWSE/mqdefault.jpg)
![Compare The Triplets HackerRank Solution [ Using Ternary Operator ]
In this video, I have explained hackerrank compare the triplets solution algorithm.
hackerrank compare the triplets problem can be solved by using ternary operator. The complexity of compare the triplets hackerrank solution is O (1). This hackerrank problem is a part of Practice | Algorithms | Warmup | Compare the triplets hackerrank challenge.
For simplicity, I have divided this hackerrank tutorial into 3 parts.
[00:00] Understanding the problem statement.
[02:30] Building the logic to solve the problem.
[05:15] Coding the logic using java (you can use your own preferred programming language).
π΄ Subscribe for more tutorials: https://www.youtube.com/channel/UCx1hbK753l3WhwXP5r93eYA?sub_confirmation=1
π Like us on Facebook: https://www.facebook.com/HackerRankSolutionTutorials
πShare this video with your friend: https://youtu.be/rFUZAtwXiII
β Join our community βΊ
π Coding interview preparation group: https://www.facebook.com/groups/codingip
π Telegram link: https://t.me/hackerranksolutions
π Resources βΊ
π Problem statement: https://www.hackerrank.com/challenges/compare-the-triplets/problem
π‘ Source code: https://github.com/Java-aid/Hackerrank-Solutions/blob/master/HackerRankDashboard/CoreCS/GeneralProgramming/src/main/java/com/javaaid/hackerrank/solutions/generalprogramming/basicprogramming/CompareTheTriplets.java
β
Recommended playlists βΊ
π All hackerrank solutions: https://www.youtube.com/watch?v=oz_yowFTrgs&list=PLSIpQf0NbcCltzNFrOJkQ4J4AAjW3TSmA
π Letβs Connect βΊ
Git Hub: https://github.com/kanahaiya
Twitter: https://twitter.com/Kanahaiyagupta
Linked in: https://www.linkedin.com/in/kanahaiya-gupta
Facebook: https://www.facebook.com/coolkanahaiya
Instagram: https://www.instagram.com/coolkanahaiya
#JAVAAID #CompareTheTriplets #HackerRankSolutions #HackerRankTutorials #HackerRank #JavaAidTutorials #programming #DataStructures #algorithms #coding #competitiveprogramming #java #codinginterview #problemsolving #KanahaiyaGupta #hackerrankchallenges #warmup Compare The Triplets HackerRank Solution [ Using Ternary Operator ]](https://i.ytimg.com/vi/rFUZAtwXiII/mqdefault.jpg)

![Count Triplets Hackerrank Solution | Interview Preparation Kit
Count Triplets hackerrank solution: In this video, I have explained how to solve hackerrank Count Triplets problem in O(N) time complexity.
This hackerrank problem is a part of Practice | Interview Preparation Kit| Dictionaries and Hashmaps| Count Triplets hackerrank challenge.
For simplicity, I have divided this hackerrank tutorial into 3 parts.
[00:00] Understanding the problem statement.
[07:13] Building the logic to solve the problem.
[23:43] Coding the logic using java (you can use your own preferred programming language).
π΄ DONT CLICK THIS: https://bit.ly/2G4cEuc
π Like us on Facebook: https://www.facebook.com/HackerRankSolutionTutorials
πShare this video with your friend: https://youtu.be/tBFZMaWP0W8
β Join our community βΊ
π Coding interview preparation group: https://www.facebook.com/groups/codingip
π Telegram link for algorithmic tutorial: https://t.me/javaaid
π Telegram link for hackerrank solutions: https://t.me/hackerranksolutions
π Resources βΊ
π Problem statement: https://www.hackerrank.com/challenges/count-triplets-1/problem
π‘ Source code: https://github.com/Java-aid/Hackerrank-Solutions/blob/master/HackerRankDashboard/Interview-Preparation-Kit/src/main/java/com/javaaid/dictionaries/CountTriplets.java
β
Recommended playlists βΊ
π All hackerrank solutions: https://www.youtube.com/watch?v=oz_yowFTrgs&list=PLSIpQf0NbcCltzNFrOJkQ4J4AAjW3TSmA
π New To JAVAAID ? Watch These Videos: https://www.youtube.com/watch?v=pVS3yhlzrlQ&list=PLSIpQf0NbcClvBksfrr_jOpZCraiog3-J
π Algorithms Fundamental: https://www.youtube.com/playlist?list=PLSIpQf0NbcCk2O05hkxHPtVqGRGtnClh8
π Coding Interview Questions: https://www.youtube.com/playlist?list=PLSIpQf0NbcCm1HjcbM6aAoDUdpZyS1YBP
π Dynamic Programming Tutorial For Beginner: https://www.youtube.com/watch?v=ewXklhesC-w&list=PLSIpQf0NbcClDpWE58Y-oSJro_W3LO8Nb
π TOP 10 LEARNING RESOURCES
1) Cracking the Coding Interview :https://amzn.to/30HFJCE
2) Algorithms Hardcover :https://amzn.to/30Hjdd9
3) The Algorithm Design Manual :https://amzn.to/2AEtEDL
4) Data Structures & Algorithms in Java :https://amzn.to/2AG82ag
5) Data Structures and Algorithms Made Easy :https://amzn.to/2M8UvNK
6) Grokking Algorithms :https://amzn.to/2LKu8yD
7) Dynamic Programming for Coding Interviews :https://amzn.to/2AC7BO9
8) Introduction to Algorithms :https://amzn.to/2oSJAzq
9) Elements of Programming Interviews in Java :https://amzn.to/30MBjKO
10) Programming Interviews Exposed :https://amzn.to/2V8mFfO
π Letβs Connect βΊ
Git Hub: https://github.com/kanahaiya
Twitter: https://twitter.com/Kanahaiyagupta
Linked in: https://www.linkedin.com/in/kanahaiya-gupta
Facebook: https://www.facebook.com/coolkanahaiya
Instagram: https://www.instagram.com/coolkanahaiya
#JAVAAID #counttriplets #HackerRankSolutions #interview-preparation-kit #HackerRank #JavaAidTutorials #programming #DataStructures #algorithms #coding #competitiveprogramming #java #codinginterview #problemsolving #KanahaiyaGupta Count Triplets Hackerrank Solution | Interview Preparation Kit](https://i.ytimg.com/vi/tBFZMaWP0W8/mqdefault.jpg)

![Sherlock and Array HackerRank Solution
Sherlock and Array hackerrank problem can be solved easily by deriving a linear equation. The complexity of Sherlock and Array hackerrank solution is O(n) which is a part of Practice | Algorithms | Search | Sherlock and array hackerrank challenge.
This video explains how to solve sherlock and array hackerrank problem in java. Here I have explained the algorithm to solve hackerrank sherlock and array problem separately and then implemented the same algorithm using java.
For simplicity, I have divided this hackerrank tutorial into 3 parts.
[00:00] Understanding the problem statement.
[03:57] Building the logic to solve the problem.
[12:52] Coding the logic using java (you can use your own preferred programming language).
π΄ Subscribe for more hackerrank tutorials: https://www.youtube.com/channel/UCx1hbK753l3WhwXP5r93eYA?sub_confirmation=1
π Like us on Facebook: https://www.facebook.com/HackerRankSolutionTutorials
πShare this video with a YouTuber friend: https://youtu.be/xPHJH8RL3mo
β Join our community βΊ
π Coding interview preparation group: https://www.facebook.com/groups/codingip
π Telegram link: https://t.me/hackerranksolutions
π Resources βΊ
π Problem statement: https://www.hackerrank.com/challenges/sherlock-and-array/problem
π Source code: https://bit.ly/2T7kRpJ
β
Recommended playlists βΊ
π All hackerrank solutions: https://www.youtube.com/watch?v=oz_yowFTrgs&list=PLSIpQf0NbcCltzNFrOJkQ4J4AAjW3TSmA
π Letβs Connect βΊ
Git Hub: https://github.com/kanahaiya
Twitter: https://twitter.com/Kanahaiyagupta
Linked in: https://www.linkedin.com/in/kanahaiya-gupta
Facebook: https://www.facebook.com/coolkanahaiya
Instagram: https://www.instagram.com/coolkanahaiya
#JAVAAID #HackerRankSolutions #HackerRankTutorials #sherlockandarray #seach #HackerRank #JavaAidTutorials #Programming #DataStructures #algorithms #coding #competitiveprogramming #JavaAidTutorials #Java #codinginterview #problemsolving #KanahaiyaGupta #hackerrankchallenges Sherlock and Array HackerRank Solution](https://i.ytimg.com/vi/xPHJH8RL3mo/mqdefault.jpg)