Count Strictly Increasing Subarrays | GeeksforGeeks

  Рет қаралды 21,639

GeeksforGeeks

GeeksforGeeks

Күн бұрын

Explanation for the article: www.geeksforgeeks.org/count-st...
Know More: www.geeksforgeeks.org/count-s...
This video is contributed by Harshit Jain.

Пікірлер: 17
@tapanbhardwaj9675
@tapanbhardwaj9675 6 жыл бұрын
These videos are very helpful. Keep going.
@Bhatonia_Jaat
@Bhatonia_Jaat 3 жыл бұрын
sir method 2 is not working as it is not counting all the subsets of increasing sub array set correct me if i am wrong!
@rohitpal36
@rohitpal36 4 жыл бұрын
have a look at my code -> int count(int *arr,int n){ int temp_count=0,k,count=0; for(int i=0;i
@ShivaniSingh-us5iw
@ShivaniSingh-us5iw 3 жыл бұрын
Thanks alot sir
@kaifahmad4131
@kaifahmad4131 3 жыл бұрын
// Count Strictly Increasing Subarrays | GeeksforGeeks //In an array function countSubArrays(arr) { let count = 0; let ind1 = 0; for(let i=1; i arr[i-1] ) { count++; console.log('Set: ',arr[i-1],arr[i]); if( (i-ind1) > 1) { count = count + (i-ind1-1); } console.log('count: ',count); } else { ind1 = i; } } return count; } let arr = [70, 74, 99, 32, 62, 30, 32, 35]; let count = countSubArrays(arr); console.log('Array: ',arr); console.log("No. of Sub Arrays: ", count); //My Solution in JS
@wecan2729
@wecan2729 3 жыл бұрын
class Solution{ public: int countIncreasing(int arr[], int n) { int len=1; int count=0; for(int i=0;iarr[i]) { len++; } else { count+=len*(len-1)/2; len=1; } } if(len>1) { count+=len*(len-1)/2; } return count; } };
@reyou7
@reyou7 6 жыл бұрын
nice video guys! keep going.
@GeeksforGeeksVideos
@GeeksforGeeksVideos 6 жыл бұрын
We're glad that you like the video :)
@indiacricket8238
@indiacricket8238 3 жыл бұрын
Check it Int sum=0; Int Count=0; For(int i=1;iarr(i-1)) ( Count++; ) Else ( Count=0; ) If(Count>0) ( Sum=Sum+Count; ) ) return Sum; )
@veerrajuyeleti8541
@veerrajuyeleti8541 7 жыл бұрын
sir could you explain with an example
@GeeksforGeeksVideos
@GeeksforGeeksVideos 7 жыл бұрын
Hi Veerraju, We've discussed examples from 0:50 to 2:20. Do you mean dry run of the code?
@168Abhinav
@168Abhinav 5 жыл бұрын
Gud
@suryakantsapkal8242
@suryakantsapkal8242 4 жыл бұрын
I believe last algorithm does not produce correct result for input like 9, 1, 11, 10
@devanggupta9986
@devanggupta9986 4 жыл бұрын
i am not sure but first we will have to sort the array and then use the last algorithm
@devanggupta9986
@devanggupta9986 4 жыл бұрын
what about if we have a repeating element in the sub array
@insofcury
@insofcury 4 жыл бұрын
well if you sort the array the whole array changes, the idea was to find increasing subarrays in the one we have here
@insofcury
@insofcury 4 жыл бұрын
@@devanggupta9986 We will not consider it as it clearly says strictly increasing
Pythagorean Triplet in an array | GeeksforGeeks
11:04
GeeksforGeeks
Рет қаралды 33 М.
ОСКАР ИСПОРТИЛ ДЖОНИ ЖИЗНЬ 😢 @lenta_com
01:01
Find minimum difference between any two elements | GeeksforGeeks
8:02
Floor and Ceiling in a sorted array | GeeksforGeeks
10:37
GeeksforGeeks
Рет қаралды 21 М.
Count Subarray sum Equals K | Brute - Better -Optimal
24:09
take U forward
Рет қаралды 231 М.
Find the minimum distance between two numbers | GeeksforGeeks
15:56
GeeksforGeeks
Рет қаралды 65 М.
Calculate the sum of all subarrays of an array
15:07
Raj Singh
Рет қаралды 9 М.
Majority Element | GeeksforGeeks
12:30
GeeksforGeeks
Рет қаралды 54 М.