862 Shortest Subarray with Sum Atleast K | Deque Coding Interview Pattern | Leetcode Hard
Double Ended Queue is a fascinating Data Structure used a lot in harder set of problems. It gives features to push/pop elements from front and back.
We are at the final problem of this week which uses a combination of Prefix Sum and Deque.
Here is the question link: leetcode.com/problems/shortes...
Connect with me on Linkedin: / bharat-khanna-717b4817b
Connect on Insta: / bharatkhanna1995
00:00-02:10 Problem Statement
02:11-06:24 Why 2 pointer & BS Search fails?
06:25-10:31 Brute Force N^3 to N^2
10:32-23:15 Main Idea
23:16-28:51 Code
Пікірлер: 6
Bhai Thank You So Much! Ek Bhi Dhang Ka Video Nahi Mil Raha Tha
@CodingwithBharat
2 ай бұрын
Thanks!
Excellent explanation Bharat bhaiya . crux to find out the pattern in which elements will be inserted in deque from back is .. Lets assume we have prefix sum A lets say deque last element is A[i] , and current element is A[j] , so if we are considering subarray for any future k with i and j , iA[i] , then we directly insert current element A[j] in deque . Thanks , for clarifying this concept .
@CodingwithBharat
4 ай бұрын
Awesome!!
good explaination
@CodingwithBharat
4 ай бұрын
Thanks Chetan!