Student Attendance Record II | Recursion | Memoization | Bottom Up | Leetcode 552 | codestorywithMIK
iPad PDF Notes - https://github.com/MAZHARMIK/Intervie...
Whatsapp Community Link : https://www.whatsapp.com/channel/0029...
This is the 96th Video of our Playlist "Dynamic Programming : Popular Interview Problems" by codestorywithMIK
In this video we will try to solve a very good DP Problem : Student Attendance Record II | Recursion | Memoization | Bottom Up | Easiest Explanation | Leetcode 552 | codestorywithMIK
I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.
Problem Name : Student Attendance Record II | Recursion | Memoization | Bottom Up | Easiest Explanation | Leetcode 552 | codestorywithMIK
Company Tags : GOOGLE
My solutions on Github(C++ & JAVA) : https://github.com/MAZHARMIK/Intervie...
Leetcode Link : https://leetcode.com/problems/student...
My DP Concepts Playlist : • Roadmap for DP | How to Start DP ? | ...
My Graph Concepts Playlist : • Graph Concepts & Qns - 1 : Graph will...
My Recursion Concepts Playlist : • Introduction | Recursion Concepts And...
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Intervie...
Instagram : / codestorywithmik
Facebook : / 100090524295846
Twitter : / cswithmik
Subscribe to my channel : / @codestorywithmik
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Summary :
Approach-1: Using Recursion + Memoization
Description: Utilizes recursion to explore all possible attendance records, memoizing results to avoid redundant calculations. Tracks three states: number of days left (n), number of absences (absent), and consecutive lates (consecutive_late). Ensures that records with 2 or more absences or 3 consecutive lates are marked invalid. Memoization table stores computed results to achieve efficiency.
Time Complexity: O(n) with memoization.
Space Complexity: O(n) due to the recursion stack and memoization table.
Approach-2: Using Bottom-Up Dynamic Programming
Description: Transforms the recursive solution into an iterative one, using dynamic programming.
Uses a 3D DP table to store the number of valid records for each day, number of absences, and number of consecutive lates. Iteratively fills the DP table based on previous day’s values, ensuring all states are computed iteratively. Base cases are initialized to handle zero days.
Time Complexity: O(n) as each day’s states are computed once.
Space Complexity: O(n) for the DP table.
✨ Timelines✨
00:00 - Introduction
4:42 - Thought Process - Recursion + Memo
22:11 - Coding Recursion + Memo
26:17 - Bottom Up
35:56 - Coding Bottom Up
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #newyear2024