Velikost videa: 1280 X 720853 X 480640 X 360
Zobrazit ovladače přehrávání
Automatické přehrávání
Přehrát
These videos are very helpful. Keep going.
Thanks alot sir
nice video guys! keep going.
We're glad that you like the video :)
Gud
have a look at my code ->int count(int *arr,int n){ int temp_count=0,k,count=0; for(int i=0;i
sir could you explain with an example
Hi Veerraju,We've discussed examples from 0:50 to 2:20. Do you mean dry run of the code?
Check itInt sum=0;Int Count=0;For(int i=1;iarr(i-1))( Count++;)Else(Count=0;)If(Count>0)(Sum=Sum+Count;))return Sum;)
sir method 2 is not working as it is not counting all the subsets of increasing sub array setcorrect me if i am wrong!
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; }};
// Count Strictly Increasing Subarrays | GeeksforGeeks//In an arrayfunction 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
I believe last algorithm does not produce correct result for input like 9, 1, 11, 10
i am not sure but first we will have to sort the array and then use the last algorithm
what about if we have a repeating element in the sub array
well if you sort the array the whole array changes, the idea was to find increasing subarrays in the one we have here
@@devanggupta9986 We will not consider it as it clearly says strictly increasing
These videos are very helpful. Keep going.
Thanks alot sir
nice video guys! keep going.
We're glad that you like the video :)
Gud
have a look at my code ->
int count(int *arr,int n){
int temp_count=0,k,count=0;
for(int i=0;i
sir could you explain with an example
Hi Veerraju,
We've discussed examples from 0:50 to 2:20.
Do you mean dry run of the code?
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;
)
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!
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;
}
};
// 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
I believe last algorithm does not produce correct result for input like 9, 1, 11, 10
i am not sure but first we will have to sort the array and then use the last algorithm
what about if we have a repeating element in the sub array
well if you sort the array the whole array changes, the idea was to find increasing subarrays in the one we have here
@@devanggupta9986 We will not consider it as it clearly says strictly increasing