Find Two Non-overlapping Sub-arrays Each With Target Sum | Simple Clean Intuition | Leetcode 1477
codestorywithMIK
0:00 / 0:00
Find Two Non-overlapping Sub-arrays Each With Target Sum | Simple Clean Intuition | Leetcode 1477
24 349 просмотров · 3 недели назад
codestorywithMIK
162 тыс. подписчиков
24 349 просмотров · 3 недели назад
☕ Support codestorywithMIK (No Pressure)
Education here is 100% free and always will be.
If the content helped you and you'd like to support the channel with a coffee:
UPI: imammazhar4@ybl
--------------------------------------------------
Whatsapp Community Link : https://www.whatsapp.com/channel/0029...
Hi Everyone, this is the 50th video of our Playlist "Sliding Window : Popular Interview Problems" by codestorywithMIK.
Today we will be solving a good problem based on sliding window : Find Two Non-overlapping Sub-arrays Each With Target Sum | Simple Clean Intuition | Leetcode 1477 | codestorywithMIK
Problem Name : Find Two Non-overlapping Sub-arrays Each With Target Sum | Simple Clean Intuition | Leetcode 1477 | codestorywithMIK
Company Tags : Will update later
My solutions on Github(C++ & JAVA) : https://github.com/MAZHARMIK/Intervie...
Leetcode Link : https://leetcode.com/problems/find-tw...
My DP Concepts Playlist : • Roadmap for DP | How to Start DP ? | Topic...
My Graph Concepts Playlist : • Graph Concepts & Qns - 1 : Graph will no m...
My Segment Tree Concepts Playlist : • Segment Tree | Introduction | Basics | Bui...
My Recursion Concepts Playlist : • Introduction | Recursion Concepts And Ques...
Trie Playlist - • Word Search II | Leetcode 212 | Detailed |...
Difference Array Technique: Concepts & Qns : • Introduction | What | How | Difference Arr...
My Line Sweep Technique Playlist : • Introduction | What | Why | Line Sweep Tec...
Meet In The Middle : Concepts & Qns : • Introduction | Meet In The Middle (MITM) |...
Binary Lifting : Concepts & Questions : • Introduction | Binary Lifting | DP On Tree...
Top K from Sorted Structures Pattern : Concepts & Questions : • Introduction | Top K from Sorted Structure...
Small Java Dopamine Videos : • Small Java Dopamine Videos | codestorywithMIK
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Intervie...
Instagram : / codestorywithmik
Facebook : / 100090524295846
Twitter : / cswithmik
Subscribe to my channel : / @codestorywithmik
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Video Summary :
We use a sliding window to find all subarrays whose sum equals target. As the window slides, we track the minimum length of any valid, non-overlapping subarray found so far up to each index i (minBestLenTillIdx), building this up left-to-right.
Whenever we find a new valid window ending at j (starting at i), any earlier valid subarray must end before i to avoid overlap , so we look up the best (shortest) such subarray using minBestLenTillIdx[i-1], and combine it with the current window's length to form a candidate answer.
This way, we never explicitly search for pairs , we just carry forward the best "left-side" length seen so far and pair it with each new valid window on the right, giving an O(n) solution overall.
✨ Timelines✨
00:00 Introduction
00:07 Motivation
00:27 Problem Explanation
02:08 Thought Process Why Sliding Window ?
08:22 What is wrong ?
08:58 Example + Correct Approach
13:36 Dry Run
24:11 Coding it up
#MIK #mik #Mik
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #coding #programming #developers #datastructures #algorithms #webdevelopment #softwareengineering #computerscience #pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview #interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #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