C ++ program for the above approach
#include <bits/stdc++.h> NEW_LINE using namespace std ; void findend ( int i , int j , vector < vector < int > > & a , vector < vector < int > > & output , int index ) { int x = a . size ( ) ; int y = a [ 0 ] . size ( ) ;