Use data structure to hold first position and last position of line // line - sequence of "0" elements in one of the dimensions in your matrix
Search lines in each dimension and store in array of line[s] //for optimization, store in separate array for each dimension: array1stDimension,array2ndDimension, array3Dimension For each line in array[n]stDimension search intersections( +/- 1 diagonal) with lines in array[n+1]Dimension (perpendicular), if found two or more such(perpendicular) lines search parallel line from array[n]stDimension that have intersections at least with two of given perpendicular lines if found, calculate area of such rectangle and compare to current max value, // here in case of 3d, store rectangle as surface structure in array if greater than max value, set max:= current val and remember coordinates of submatrix In case of 2d array(matrix), it's all. For 3d array most easy way is to implement structure surface, and search intersections with other surface[s] to get cube -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com.