India’s Best Job Seekers and Training Platform Forums Java Problems set Input will be a matrix consiting…

  • Input will be a matrix consiting…

  • Akash 

    Administrator
    at

    Input will be a matrix consiting of only 1’s n 0’s.

    The 1’s represent the lines and 0’s its absence.

    For eg a matrix 6X7 is shown

    0 0 0 1 1 1 1

    0 1 1 1 0 1 1

    0 1 0 1 0 1 1

    0 1 0 1 0 1 1

    0 1 1 1 0 1 1

    0 0 0 1 1 1 1

    In the above matrix, the sequence of 1’s represents the lines. These eight lines constitute three

    rectangles.

    Conditons :

    1. The rectangles will always enclose some 0’s. e.g. last two vertical lines does not constitute a

    rectangle.

    2. A rectangle can contain multiple rectangles

    Output : should be no. of rectangles formed in the matrix(intersecting rectangles are also counted).

Log in to reply.

Original Post
0 of 0 posts June 2018
Now
KodNest Training New Batch is starting on 02nd November 2020. Attend one week free demo classes.Register Now

New Report

Close