scan rightward first then scan downward to get Maxiaml Rectangle