0 votes 0 votes # plz explain??? i am not understand question?? Algorithms testbook-test-series test-series + – Hradesh patel asked Jan 22, 2017 • retagged Jun 4, 2017 by Arjun Hradesh patel 424 views answer comment Share Follow See all 7 Comments See all 7 7 Comments reply papesh commented Jan 22, 2017 reply Follow Share In each row 1's and 0's are there such that all 1's ahead of all 0's ... So we need to check only (moddle+1) bit of Each row ... One loop is sufficient... from row1 to rown. I think most means, the number of 1's are more than 0's... 0 votes 0 votes Rahul Jain25 commented Jan 22, 2017 reply Follow Share What is given answer O(n log n)??? 0 votes 0 votes Hradesh patel commented Jan 22, 2017 reply Follow Share @Gabbar what is complexity?? 0 votes 0 votes Hradesh patel commented Jan 22, 2017 reply Follow Share @Rahul its given O(n)?? 0 votes 0 votes Rahul Jain25 commented Jan 22, 2017 reply Follow Share @gabbar what if all rows have last 1 before the middle index???? @hardesh what is explanation given?? 0 votes 0 votes Hradesh patel commented Jan 22, 2017 reply Follow Share solution which is given?? 0 votes 0 votes Rahul Jain25 commented Jan 22, 2017 reply Follow Share I think that was really a bad solution. They are asking to go n times(possible in worst case) in each row which show make it n2 and not 2n. My approach is to find leftmost 1 or rightmrightmist 0 in each row that is going to take logn time. For each row do the same O(n log n) 0 votes 0 votes Please log in or register to add a comment.