Leetcode #554. Brick Wall || Code +Explanation + Example Walkthrough

preview_player
Показать описание
554. Brick Wall
Medium

There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. You want to draw a vertical line from the top to the bottom and cross the least bricks.

The brick wall is represented by a list of rows. Each row is a list of integers representing the width of each brick in this row from left to right.

If your line go through the edge of a brick, then the brick is not considered as crossed. You need to find out how to draw the line to cross the least bricks and return the number of crossed bricks.

You cannot draw a line just along one of the two vertical edges of the wall, in which case the line will obviously cross no bricks.

Рекомендации по теме
Комментарии
Автор

thank you. Once I understood the concept via your video, I managed to code it without looking at the solution. thank you <3

anishaa
Автор

I am leaving at 2:02 the moment you said gap + cut = wall.size you are Awesome thanku ^_^ .

AkashYadav-cxig
Автор

Awesome explanation! Keep up the good work. Looking for more content from your side.

amolmishra
Автор

Thanks for explaining the concept and code walkthrough,

varadashtekar
Автор

Bhai sach bol raha hu, jab inka lecture dkhta hu samaj nhi aata isko dekhu aur padai karu..

abumotalebrony
Автор

brilliant explanation, Thank you for sharing and giving your time to explain to us :)
One suggestion instead of using hasmap try to use with int[], it'll take less time

Tarun-Mehta
Автор

Made this look really easy
Thanks !!

dharmikgovani
Автор

awsome explanation
I was facing a lot trouble doing this

shubhamgarg
Автор

Try to upload challenges video every day, and even others questions.

harshitpandey
Автор

How did you come up with the solution?

nilaysheth
visit shbcf.ru