human
Count of indices in an array that satisfy the given condition | Function to return the count of indices that satisfy the given condition.
To store the result.
To store the current maximum Initialized to 0 since there are only positive elements in the array.
i is a valid index.
Update the maximum so far.
Increment the counter.
Driver code"
Solution in Python:
 ... What is a code to count of indices in an array that satisfy the given condition and the other steps required?
assistant
#Here is code to count of indices in an array that satisfy the given condition and the other steps required.
 def countIndices ( arr , n ) :
	cnt = 0 ;
	max = 0 ;
	for i in range ( n ) :
		if ( max < arr [ i ] ) :
			max = arr [ i ] ;
			cnt += 1 ;
	return cnt ;
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 2 , 3 , 4 ] ;
	n = len ( arr ) ;
	print ( countIndices ( arr , n ) ) ;