Grid Game | Detailed Explanation | Complete Ry Run | Leetcode 2017 | codestorywithMIK

Subscribers:
92,300
Published on ● Video Link: https://www.youtube.com/watch?v=Y8VC_OnkazE



Game:
The Grid (2000)
Duration: 0:00
10,199 views
581


Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A

Hi Everyone, this is the 137th video of our Playlist "Arrays 1D/2D : Popular Interview Problems".
Now we will be solving a very good problem based on Game Strategy in a 2D Array Game - Grid Game | Detailed Explanation | Complete Ry Run | Leetcode 2017 | codestorywithMIK

Problem Name : Grid Game | Detailed Explanation | Complete Ry Run | Leetcode 2017 | codestorywithMIK
Company Tags : will update later
My solutions on Github(C++ & JAVA) - https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Arrays/Cumulative_Sum(Prefix Array)/Grid Game.cpp
Leetcode Link : https://leetcode.com/problems/grid-game


My DP Concepts Playlist :    • Roadmap for DP | How to Start DP ? | ...  
My Graph Concepts Playlist :    • Graph Concepts & Qns - 1 : Graph will...  
My Segment Tree Concepts Playlist :    • Segment Tree | Introduction | Basics ...  
My Recursion Concepts Playlist :    • Introduction | Recursion Concepts And...  
Trie Playlist -    • Word Search II (Google, Amazon, Meta,...  
Difference Array Technique: Concepts & Qns :    • Introduction | What | How | Differenc...  
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Instagram : https://www.instagram.com/codestorywithmik/
Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/
Twitter : https://twitter.com/CSwithMIK
Subscribe to my channel :    / @codestorywithmik  

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝


Video Summary :
The problem involves two robots, Robot1 and Robot2, navigating through a 2D grid. Robot1 moves first and selects a column in the grid, while Robot2 moves afterward and tries to minimize the remaining sum in the second row of the grid. The goal is to minimize the sum that Robot2 has to deal with after Robot1 has made its move.

Thought Process:

Initial Setup: The sum of all elements in the first row (firstRowRemainSum) is calculated at the start. This helps track the remaining sum for Robot1's strategy.
Iterative Strategy: For each column, Robot1 "takes" that column by subtracting the value from firstRowRemainSum. This simulates Robot1's choice.
Robot2's Best Response: After Robot1's choice, Robot2 attempts to minimize the remaining sum in the second row by selecting the best possible outcome (max between remaining sums of the first and second rows).
Tracking the Minimum: The goal is to track the minimum possible sum for Robot2 by updating minimizedRobot2Sum at each step.
Approach:

Accumulation: The sum of the first row is accumulated at the start, and then progressively updated as Robot1 moves.
Max/Min Operations: For each column, the maximum of the remaining sum of the first row and the accumulated sum of the second row is calculated, and the minimum of these values is tracked.
Efficiency: The algorithm processes each column once, resulting in a time complexity of O(col), where col is the number of columns in the grid.
Intuition:


✨ Timelines✨
00:00 - Introduction
0:15 - Motivation
0:41 - Problem Explanation
5:01 - Thought Process and Intuition
21:17 - Complete Dry Run
29:39 - Coding it up


#MIK #mik #Mik
#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 #coding #programming #100daysofcode #developers #techjobs #datastructures #algorithms #webdevelopment #softwareengineering #computerscience #pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview #interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #hindi #india #hindicoding #hindiprogramming #hindiexplanation #hindidevelopers #hinditech #hindilearning #helpajobseeker #jobseekers #jobsearchtips #careergoals #careerdevelopment #jobhunt #jobinterview #github #designthinking #learningtogether #growthmindset #digitalcontent #techcontent #socialmediagrowth #contentcreation #instagramreels #videomarketing #codestorywithmik #codestorywithmick #codestorywithmikc #codestorywitmik #codestorywthmik #codstorywithmik #codestorywihmik #codestorywithmiik #codeistorywithmik #codestorywithmk #codestorywitmick #codestorymik #codestorwithmik




Other Videos By codestorywithMIK


2025-01-27Achaaaaaa ☕️🧑🏻‍💻
2025-01-26Maximum Employees to Be Invited to a Meeting | Super Detailed | Leetcode 2127 | codestorywithMIK
2025-01-25Course Schedule IV | 3 Detailed Approaches | Leetcode 1462 | codestorywithMIK
2025-01-24Make Lexicographically Smallest Array by Swapping Elements | Brute Force | Optimal | Leetcode 2948
2025-01-24My First Salary ❤️
2025-01-23Bas aur kya batau ?
2025-01-22Count Servers that Communicate | 3 Detailed Approaches | Dry Runs | Leetcode 1267 | codestorywithMIK
2025-01-22Interviewer vs Candidate 😏
2025-01-22TLE agaya last waale test case me 🥺
2025-01-20It’s Time | Go Get It
2025-01-20Grid Game | Detailed Explanation | Complete Ry Run | Leetcode 2017 | codestorywithMIK
2025-01-19First Completely Painted Row or Column | 3 Approaches | Detailed | Leetcode 2661 | codestorywithMIK
2025-01-18Trapping Rain Water II | Deep Dive Explanation | What | Why | How | Leetcode 407 | codestorywithMIK
2025-01-17Minimum Cost to Make at Least One Valid Path in a Grid | 2 Detailed Approaches | Leetcode 1368 | MIK
2025-01-16Multi-Source BFS | What | Why | How | Detailed | Graph Concepts & Qns - 46 | codestorywithMIK
2025-01-15Bitwise XOR of All Pairings | 2 Simple Approaches | Dry Runs | Leetcode 2425 | codestorywithMIK
2025-01-15Neighboring Bitwise XOR | 2 Detailed Approaches | Dry Runs | Leetcode 2683 | codestorywithMIK
2025-01-14Minimize XOR | 2 Detailed Approaches | Dry Runs | Leetcode 2429 | codestorywithMIK
2025-01-13Find the Prefix Common Array of Two Arrays | 3 Detailed Approach | Leetcode 2657 | codestorywithMIK
2025-01-13DSA Shorts with MIK - 9
2025-01-12Minimum Length of String After Operations | 2 Approaches |Intuition |Leetcode 3223 |codestorywithMIK