Skip to main content

Posts

Showing posts from February, 2018

Find the number of negative integers from row wise or column wise from a sorted matrix

Find the number of negative integers from row wise or column wise from a sorted matrix This is a frequently asked question for a experienced interview. Here i am trying to solve this in two different ways, normal way and an optimised method. Main Class /** * */ package com . rakesh . matrix . bo ; /** * @author Rakesh KR * @since August 19th 13:15 2k17 */ public class RunMatrix { public static void main ( String [] args ) { MatrixUtils matrixUtils = new MatrixUtils (); try { System . out . println ( "------ Matrix ------" ); matrixUtils . makeMartix (); // matrixUtils.printMatrix(); matrixUtils . sortRowMatrix (); matrixUtils . transpose (); matrixUtils . sortRowMatrix (); matrixUtils . transpose (); // matrixUtils.printMatrix(); long t1 = System . currentTimeMillis (); System . out . println ( "NegativeNumbers Count Normal Way : " + matrixUtils . countNega...