there n city some connect if city connect directly city b city b connect directly city c city connect indirectly city cA province group directly indirectly connect city city outside groupyou give n x n matrix isconnecte isConnectedij 1 ith city jth city directly connect isConnectedij 0 otherwisereturn total number province Example 1input isconnecte 110110001output 2example 2input isconnecte 100010001output 3 Constraints1 n 200n isConnectedlengthn isconnectedilengthisconnectedij 1 0isconnectedii 1isconnectedij isconnectedji