Longest Common subarray in 2d matrix
Anonymous User
3054

You are given with a two dimensional matrix with M rows and N columns.
you need find the length of longest common subarray among all rows of matrix
Example1 :

	M = 2
	N = 3
	Matrix: [[1, 2, 3], [2, 3, 4]]
	
	Ans: 2 
	
	Explanation: [2, 3]  is the longest common subarray among both rows
	

Example2:

	M = 3
	N = 4
	Matrix: [[1, 2, 3, 4], [4, 1, 2, 3], [5, 1, 2, 3]]
	
	Ans: 3
	
	Explanation: [1, 2, 3] is the longest common subarray among all rows
Comments (4)