In this problem you are given a string that is repeated infinite number of times, and you have to find the frequency of the character 'a' in the first 'n' letters. A good way to approach this problem is by using mathematical induction and predicting how the string would look like after several repetitions. Watch the video to understand the problem statement correctly, and how can we derive the mathematical formula to solve it efficiently. All along with visuals and animations.
Chapters:
00:00 - Intro
00:58 - Problem statement and description
02:56 - Brute Force Solution
04:26 - Efficient solution using maths
08:12 - Dry-run of the code
09:54 - Final Thoughts
Actual problem on HackerRank: https://www.hackerrank.com/challenges...
📚 Links to topics I talk about in the video:
Brute Force Algorithms: • Brute Force algorithms with real life...
Time Complexity: • What is the Time Complexity of an Alg...
What is Big O?: • Big O Notation Simplified to the MAX ...
📘 A text based explanation is available at: https://studyalgorithms.com/string/ha...
Code on Github: https://github.com/nikoo28/java-solut...
Test-cases on Github: https://github.com/nikoo28/java-solut...
📖 Reference Books:
Starting Learn to Code: https://amzn.to/36pU0JO
Favorite book to understand algorithms: https://amzn.to/39w3YLS
Favorite book for data structures: https://amzn.to/3oAVBTk
Get started for interview preparation: https://amzn.to/39ysbkJ
🔗 To see more videos like this, you can show your support on: https://www.buymeacoffee.com/studyalg...
🎥 My Recording Gear:
Recording Light: https://amzn.to/3pAqh8O
Microphone: https://amzn.to/2MCX7qU
Recording Camera: https://amzn.to/3alg9Ky
Tablet to sketch and draw: https://amzn.to/3pM6Bi4
Surface Pen: https://amzn.to/3pv6tTs
Laptop to edit vidoes: https://amzn.to/2LYpMqn
💻 Get Social 💻
Follow on Facebook at: / studyalgos
Follow on Twitter at: / studyalgorithms
Follow on Tumblr at: / studyalgos
Subscribe to RSS feeds: https://studyalgorithms.com/feed/
Join fan mail: http://eepurl.com/g9Dadv
#hackerrank #programming #interview