Hello, I am not sure if i understand it correctly. still no harm in trying.... to check for any diagonal elements, you will have to navigate thru each element of the array and check diagonal elements for each. example : suppose the current array element u r checking is arr( x , y ) the possible digonal elements are arr ( x-1, y-1 ) arr ( x+1, y-1 ) arr ( x-1, y+1 ) arr ( x+1, y+1 ) out of which i think you need not check for arr ( x-1, y-1 ) and arr ( x+1, y-1 ) as while navigating if you start from x=0,y=0 these 2 elements would have been already checked. so u need to check only the remaining 2 elements. if any of these 2 is same as the arr( x , y ) then you have ur diagonals hth sorry if i confused u more :) was just trying to help :)