Count Strictly Increasing Subarrays | GeeksforGeeks

Пікірлер: 17

  • @Bhatonia_Jaat
    @Bhatonia_Jaat3 жыл бұрын

    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
    @rohitpal364 жыл бұрын

    have a look at my code -> int count(int *arr,int n){ int temp_count=0,k,count=0; for(int i=0;i

  • @tapanbhardwaj9675
    @tapanbhardwaj96756 жыл бұрын

    These videos are very helpful. Keep going.

  • @ShivaniSingh-us5iw
    @ShivaniSingh-us5iw3 жыл бұрын

    Thanks alot sir

  • @veerrajuyeleti8541
    @veerrajuyeleti85417 жыл бұрын

    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?

  • @suryakantsapkal8242
    @suryakantsapkal82424 жыл бұрын

    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

  • @reyou7
    @reyou77 жыл бұрын

    nice video guys! keep going.

  • @GeeksforGeeksVideos

    @GeeksforGeeksVideos

    7 жыл бұрын

    We're glad that you like the video :)

  • @kaifahmad4131
    @kaifahmad41313 жыл бұрын

    // 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

  • @indiacricket8238
    @indiacricket82383 жыл бұрын

    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; )

  • @wecan2729
    @wecan27293 жыл бұрын

    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; } };

  • @168Abhinav
    @168Abhinav5 жыл бұрын

    Gud