A group of connected 1s forms an island now your task is to complete the method **findIslands** which returns the no of islands present. The function takes three arguments the first is the boolean matrix A and then the next two arguments are N and M denoting the size of the matrix A .

**Input:**

The first line of input will be the no of test cases T then T test cases follow. The first line of each test case contains Two space separated integers N and M. Then in the next line are the NxM inputs of the matrix A separated by space .

**Output:**

The output in the expected output will be the total no of islands present.

**Constraints:**

1<=T<=100

1<=N,M<=50

0<=A[][]<=1

**Example(To be used only for expected output) :
Input**

1

3 3

1 1 0 0 0 1 1 0 1

2

The graph will look like

1 1 0

0 0 1

1 0 1

Here two islands will be formed

First island will be formed by elements { A[0][0] , A[0][1], A[1][2], A[2][2] }

Sec island will be formed by { A[2][0] }

Author: Shubham Joshi 1

bol_na_aunty_aau_kya | 82 |

Apurve Dave | 76 |

sheraf ansari 1 | 74 |

rex_wulf | 72 |

manishSinghal | 71 |

Apurve Dave | 624 |

CAGEROT | 576 |

Manku Pathak | 575 |

Siddhant Srivastava 1 | 565 |

Amit Pandey 9 | 562 |

akhayrutdinov | 4723 |

Quandray | 3902 |

sanjay05 | 3668 |

Ibrahim Nash | 3664 |

surbhi_7 | 2816 |