Problem 51630. Highest building
Input: Sketch of the outline of the buildings in a matrix.
Output: The column number of the highest building and height of it. In two or more building are the highest, you need to choose the first one.
Example:
Let us consider buildings described by the matrix
M=[0 0 1 0;
1 0 1 1;
1 1 1 1;
1 1 1 1]
- The height of the first building (1st column) is 3,
- the height of the second building (2nd column) is 2,
- the height of the third building is 4,
- the height of the last building is 3.
The correct answer to highest_building(M) is [3, 4] (the building n°3 is the highest with height = 4).
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers32
Suggested Problems
-
Replace NaNs with the number that appears to its left in the row.
3057 Solvers
-
Sum of odd numbers in a matrix
612 Solvers
-
Create Vector containing following elements
142 Solvers
-
Find out sum of all elements of given Matrix
529 Solvers
-
Find the sides of an isosceles triangle when given its area and height from its base to apex
2118 Solvers
More from this Author53
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!