Counts 1 s that can be obtained in an Array by performing given operations | Function to count total number of 1 s in array by performing the given operations ; Stores count of 1 s in the array by performing the operations ; Update cntOnes ; Driver Code
def cntOnesArrWithGivenOp ( arr , N ) : NEW_LINE INDENT cntOnes = 0 ; NEW_LINE cntOnes = int ( N ** ( 1 / 2 ) ) ; NEW_LINE return cntOnes ; NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT arr = [ 0 , 0 , 0 , 0 , 0 ] ; NEW_LINE N = len ( arr ) ; NEW_LINE print ( cntOnesArrWithGivenOp ( arr , N ) ) ; NEW_LINE DEDENT