text: Finding the matrix mapping by considering non prime number as obstacle and prime number be valid path .
code: static void preprocessMatrix ( int [ , ] mappedMatrix , int [ , ] a , int n , int m ) { int [ ] prime = new int [ MAX ] ;