Maximize count of strings of length 3 that can be formed from N 1 s and M 0 s | C ++ program for the above approach ; Function that counts the number of strings of length 3 that can be made with given m 0 s and n 1 s ; Print the count of strings ; Driver Code ; Given count of 1 s and 0 s ; Function Call
#include <bits/stdc++.h> NEW_LINE using namespace std ; void number_of_strings ( int N , int M ) { cout << min ( N , min ( M , ( N + M ) / 3 ) ) ; } int main ( ) { int N = 4 , M = 19 ; number_of_strings ( N , M ) ; return 0 ; }