Number Of Subarrays With Bounded Maximum | Leetcode 795 Solution in Hindi
Vložit
- čas přidán 13. 06. 2021
- Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. 1. We have an array 'arr' of positive integers, and two positive integers left and right (left is smaller than right).
2. Return the number of (contiguous, non-empty) subarrays such that the value of the maximum array element in that subarray is at least left and at most right.
Topic: #subArrays
Used #DataStructure: #Arrays
#TimeComplexity: O(n)
#SpaceComplexity: O(1)
--------------------------------------------------------------
Linked Questions:
1. Print All SubArrays : • Subarrays of an Array ...
---------------------------------------------------------------
For detailed information and other exercises, VISIT: www.pepcoding.com
Have a look at our result: www.pepcoding.com/placements
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education
----------------------------------------------------------------
#subarrays, #learning, #coding, #leetcode, #gfg, #pepcoding, #boundedMax,#pepcodingSubarrays, #Arrays, #Strings, #dsa, #algorithms, #maths
For a better experience and more exercises, VISIT: www.pepcoding.com/resources/
Have a look at our result: www.pepcoding.com/placements
Follow us on our CZcams page: / pepcoding
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education
Follow us on Pinterest: / _created
Follow us on Twitter: home
.
.
.
Happy Programming !!! Pep it up 😍🤩
.
.
.
#pepcoding #code #coder #codinglife #programming #coding #java #freeresources #datastrucutres #pepcode #competitive #competitiveprogramming #softwareengineer #engineering #engineer
bada hi gajab discussion rha, Thanks pepcoding for providing such great content free of cost.
boht hi shandaar explainationt tha dimaag mai aya hi nhi prev count wala fanda pehle se khud se ,but ab bhoolunga nhi
Thanks a lot Sir. Enjoyed your thorough walkthrough a lot.
awesome explanation
Such an awesome explanation. Thank you.
Thankyou
I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
thank you for the solution and great expiation
Such an excellent explanation sir. Thank you!!
Glad you liked it!
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
great !
Best👌🔥🛐
Nice question, great explanation!
Thankyou
I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Bahut badiya smjhaya
Ye q itna clear ni hua
Sir shouldn't the complexity in the case of Brute Force be O(n3), because O(n2) complexity for finding all the sub-arrays and then traversal in that array will take O(n) for finding max. Please verify?
We can maintain a variable max and find max while calculating subarrays and check it that it lies in between bounds
@@rishabhyadav4994 okay. Then the time complexity stays the same as O(n2)
great explaination
Love to hear that for better experience and well organised content sign up on nados.io and start learning.
nicee
🙌
Number of subarrays = n*n+1 / 2 , so shouldn't we add this in the final count instead of (ei-si+1) ?
No bro number of subarrays formula will give all the sub arrays including the elements which are smaller the left but the ei-si+1 will give only those sub arrays whose ending index is ei
wrong answer, wont work for 213412