Maximum Value at a Given Index in a Bounded Array || Math || Binary Search || Leetcode 1802

In this video, I'll talk about how to solve the problem Leetcode 1802. Maximum Value at a Given Index in a Bounded Array
Problem Link: leetcode.com/problems/maximum...
Code & Notes: drive.google.com/file/d/1idh2...
Maximum Value at a Given Index in a Bounded Array || Math || Binary Search || Leetcode 1802
Let's Connect:
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / aryan_mittal_007
📱Telegram : t.me/aryan_mittal_group
🤖 Github: github.com/aryan-0077
🛍️ Products I use in Videos: (✨ Marked for Mostly requested Products)
Main Camera (Canon 200D ii): amzn.to/41cfS5h
Vlog Camera (iphone 13): amzn.to/42aOJRh
Tripod for Lectures: amzn.to/3HMoloF
Tripod for Vlogs: amzn.to/44wGL6L
✨Mic: amzn.to/41bj8gU
Shadow Multi Colour Light: amzn.to/41bmIrq
Main Light: amzn.to/3LF6BNb
Tripod for Lights: amzn.to/3LFcQAt
Softbox for Lights: amzn.to/42mHqWE
✨My Pen Tablet for Notes: amzn.to/44A61ZJ
✨New Tablet for Notes: amzn.to/44BjTDa
Tablet Stand: amzn.to/3NMFIJR
Power Bank: amzn.to/421yHsZ
✨USB Hub: amzn.to/3p8NGTf
✨HardDisk to store Lectures: amzn.to/3HKafEs
✨My Laptop: amzn.to/44w12ct
✨My Monitor: amzn.to/3LCG6YL
My UPS: amzn.to/3Lydy2y
My UPS old: amzn.to/3LXT0C3
✨My Mouse: amzn.to/3LYmJdY
✨My Keyboard: amzn.to/3NJs4ah
Resources you can try:
Learn Coding: • Complete RoadMap for C...
🎥Channel Playlists
🎥 Baap Graph Series - by Aryan: • Baap Graph Series - by...
🎥Dynamic Programming: • Complete Dynamic Progr...
🎥Bit Manipulation: • Complete BIT MANIPULAT...
🎥Mathematics for DSA: • Complete Mathematics f...
🎥Leetcode Top Interview Questions: • FAANG & Leetcode Inter...
🎥Codeforces Problem B Ladder: • Complete PROBLEM B LAD...
🎥Codeforces Problem C Ladder: • Codeforces PROBLEM C L...
🎥Codeforces Problem D Ladder: • Complete PROBLEM D LAD...
🎥 Top 150 Interview Questions: • Top 150 Interview Ques...
🎥 Complete Array Problem Playlist: • Complete Array Intuit...
🎥 Complete Binary Search Problem Playlist: • Complete Binary Search...
🎥 Complete Stack Playlist: • Complete Stack & Queue...
🎥 Complete Graph Problem Playlist: • Complete Graph Intuiti...
🎥 Complete TREE Playlist: • Complete TREE Intuitio...
🎥 Complete DP Problem Solving: • Complete DP Intuition ...
🎥 Complete Linked List: • Complete Linked List I...
🎥 Complete Greedy Problem Playlist: • Complete Greedy Intui...
🎥 Complete Divide & Conquer Algorithm Playlist: • Complete Divide & Conq...
🎥 Complete Trie Playlist: • Complete Trie Intuitio...
🎥 Complete Mathematics & Number Theory Problems: • Complete Mathematics &...
About Channel:
We teach about how you can grow in life & educate about programming in Fun & Intuitional way.
About Me:
I am Aryan Mittal - a Software Engineer, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Timelines✨
0:00 - Problem Explanation
3:09 - Intuition & Logic
15:30 - Code Explanation
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms

Пікірлер: 52

  • @ARYANMITTAL
    @ARYANMITTAL Жыл бұрын

    Code & Notes: drive.google.com/file/d/1idh2GHvawPRvYUqvV4rGWkX_rToLEav6/view?usp=sharing Kon kon logic soch liya tha Binary Search and AP ka ?? 💪

  • @roshanraturi6450

    @roshanraturi6450

    Жыл бұрын

    ME BUT IMPLEMENTATION NHI HO PARHA THA THIK SE ..THANK YOU FOR YOUR INTUTION && LOGIC

  • @vaibhav8257
    @vaibhav8257 Жыл бұрын

    Clearly Understood the intuition thanks!

  • @ManojKumarManuSai
    @ManojKumarManuSai Жыл бұрын

    Great explanation. Thanks Aryan.

  • @niteshshandilya4226
    @niteshshandilya4226 Жыл бұрын

    gr8 bhai

  • @user-pz2ng5qq6y
    @user-pz2ng5qq6y Жыл бұрын

    Best explanation so far!

  • @oqant0424
    @oqant0424 Жыл бұрын

    Thanks for the excellent explanation

  • @kunjdabhi943
    @kunjdabhi943 Жыл бұрын

    Great Explanation!!!

  • @abhishekvishwakarma9045
    @abhishekvishwakarma9045 Жыл бұрын

    Best explanation 🔥 Keep going aryan

  • @StellasAdi18
    @StellasAdi18 Жыл бұрын

    Best explanation!

  • @rmaravind940
    @rmaravind940 Жыл бұрын

    excellent explanation made my day

  • @gouravkumarshaw417
    @gouravkumarshaw417 Жыл бұрын

    Nice explanation thanks!!

  • @rupdeepthey
    @rupdeepthey Жыл бұрын

    Thanks for the help bro.🙏

  • @dhanashreegodase4445
    @dhanashreegodase4445 Жыл бұрын

    suchh a great explanation

  • @AmarjeetKumar-to9ub
    @AmarjeetKumar-to9ub Жыл бұрын

    Thank You :)

  • @suneedhiladdha
    @suneedhiladdha Жыл бұрын

    what if you have repeating numbers so say ur trying to make 18 with an array of 5 with index 2 maximized so you might have 34443. How do you apply n(n+1)/2 to it?

  • @vedbhanushali608
    @vedbhanushali608 Жыл бұрын

    nice explanation thanks .

  • @piyushnautiyal5112
    @piyushnautiyal5112 Жыл бұрын

    Its giving runtime error signed integer overflow even after using long long int what to do brother

  • @ananttater1146
    @ananttater1146 Жыл бұрын

    Thanks bro...

  • @iamnoob7593
    @iamnoob75932 ай бұрын

    Man this is brilliant

  • @anmolraj4995
    @anmolraj4995 Жыл бұрын

    hey why are we taking ele as mid -1 not simply mid

  • @SD-vk3ko
    @SD-vk3ko Жыл бұрын

    Hey Aryan, I regularly watch your videos... Thanks for all the effort you put in. I have a question, if you don't mind answering, is, How much the solution will differ, if the question would allow "0" in array?

  • @ialgorithms

    @ialgorithms

    Жыл бұрын

    Thanks for bringing this up, I was on the same page. If 0 is allowed (or the range was 0 < i < n), then nums[index] will be maxSum. Values to the left of nums[index] will be 0 and right will be 0. Which satisfies other conditions.

  • @_hrishav_

    @_hrishav_

    Жыл бұрын

    @@ialgorithms If nums[index]==maxSum & all other indices have 0, then how will "abs(nums[i] - nums[i+1])

  • @ialgorithms

    @ialgorithms

    Жыл бұрын

    @@_hrishav_ The question asked in this question (First comment) has no correlation with the actual problem statement. It's a though process which occurred when solving the problem for the first time presuming that "0" was allowed in the array list. So, you could ignore this comment as it has nothing to do with the actual question. To your question, abs(nums[i] - nums[i+1])

  • @sathishkumar-dc9ce
    @sathishkumar-dc9ce Жыл бұрын

    Hi Aryan, should the leftpart and rightpart of the array (excluding index) always be array[index]-1. Cant it also be array[index]?. In simple words shoud ele=mid-1 or it can be mid also. Because I have seen results like [1,2,2,1] where index is 2. Can somebody explain this.

  • @arshgupta9038

    @arshgupta9038

    Жыл бұрын

    it can be array[mid] as well. it can also be array[index]-1.In order to minimise the sum we do array[mid]-1. [1,2,2,1] could also be written as [1,2,1,1] .We try to minimise the sum , so we can get the max value at index which can pass the sum condition

  • @sakshamgupta3921
    @sakshamgupta3921 Жыл бұрын

    bhaiya just a small and silly doubt, how do you determine that we can't make the array just by knowing the limit is e^9? ik its related to time complexity but then till which range can we make the array or check for each number?

  • @tonyli1957
    @tonyli195711 ай бұрын

    you are f***g smart

  • @sunwoodad
    @sunwoodad11 ай бұрын

    Thank you, you are the best. One question, inside of while loop, why el should be mid-1? It can't be mid?

  • @satwiktatikonda764
    @satwiktatikonda7645 ай бұрын

    what are the earlier 2 concepts

  • @poojithkumar2283
    @poojithkumar2283 Жыл бұрын

    if the array contains negetive numbers how to find the sum

  • @salmankhader1258
    @salmankhader1258 Жыл бұрын

    plz upload the leetcode contest solutions as well

  • @sambitbasu6261
    @sambitbasu6261 Жыл бұрын

    Maybe this is a silly question, but why are we taking el =mid - 1?

  • @kushagraahire1871

    @kushagraahire1871

    Жыл бұрын

    0 based indexing

  • @anzilmufti2682

    @anzilmufti2682

    Жыл бұрын

    @@kushagraahire1871 why are we even taking el=mid-1, i mean what's the logic behind it

  • @kushagraahire1871

    @kushagraahire1871

    Жыл бұрын

    ​@@anzilmufti2682 Logically it is not compulsory to take mid -1 , we can take mid also the code should run

  • @udaytewary3809
    @udaytewary3809 Жыл бұрын

    How at 7:26 array sum is equal to maxSum as array sum is 10 and array sum is 11

  • @aurobindsahu4355

    @aurobindsahu4355

    Жыл бұрын

    ye mujhe clear nhi hua

  • @himanshumaurya479
    @himanshumaurya479 Жыл бұрын

    your explaination is good but try to explain slowly.

  • @sravanigundepalli3513
    @sravanigundepalli3513 Жыл бұрын

    can someone please explain how to learn from given constraints

  • @password47403

    @password47403

    Жыл бұрын

    I also had a similar doubt as to how to analyze the constraints properly...check out this video of Aditya Verma where he shows how to analyse the constraints! All The Best!

  • @sravanigundepalli3513

    @sravanigundepalli3513

    Жыл бұрын

    @@password47403 Okayy thank you :)

  • @riskyone9600
    @riskyone9600 Жыл бұрын

    explanation - INT_MIN, but but but but but but but but but = LONG _MAX

  • @raginibhayana8305
    @raginibhayana8305 Жыл бұрын

    can you please send the link of the two questions having the same concepts as of this question?

  • @ashishdhal4614

    @ashishdhal4614

    Жыл бұрын

    Try solving search space problems in striver's a2z sheet

  • @raginibhayana8305

    @raginibhayana8305

    Жыл бұрын

    @@ashishdhal4614 thank you

  • @dimabirenbaum9200
    @dimabirenbaum9200 Жыл бұрын

    I had to lower my sound to a minimum to keep listening to the explanation. I understand, you try to be different from others, but your main content is an explanation, not entertainment. The result of the video should be an understanding of the solution and key points learned, not the headache.

  • @vedantupadhyay42
    @vedantupadhyay42 Жыл бұрын

    Feels like should drop programming..

  • @anandharsh1773
    @anandharsh1773 Жыл бұрын

    bhaii thoda over acting kam kiya kar.

  • @thedarkknight1865
    @thedarkknight1865 Жыл бұрын

    butt butt butt band kar bhai

  • @snigdhobhattacharya4697
    @snigdhobhattacharya4697 Жыл бұрын

    Thanks for the excellent explanation