Skip to main content
deleted 1 character in body
Source Link

You could look at it in a different way, transform the wall of bricks to a wall of edges, in your example it would be

1, 3, 5
3, 4
1, 4
2
3, 4
1, 4, 5

The first, the third and the last rowsrow have an edge at 1, thus you can draw a line that crosses three bricks less than the height of the wall. You need to find the edge that appears the most.

In this case it would be four it appears in rows 2,3,5,6.

After transforming the wall to a wall of edges, a SelectMany into a GroupBy and Max will do the trick.

You could look at it in a different way, transform the wall of bricks to a wall of edges, in your example it would be

1, 3, 5
3, 4
1, 4
2
3, 4
1, 4, 5

The first, the third and the last rows have an edge at 1, thus you can draw a line that crosses three bricks less than the height of the wall. You need to find the edge that appears the most.

In this case it would be four it appears in rows 2,3,5,6.

After transforming the wall to a wall of edges, a SelectMany into a GroupBy and Max will do the trick.

You could look at it in a different way, transform the wall of bricks to a wall of edges, in your example it would be

1, 3, 5
3, 4
1, 4
2
3, 4
1, 4, 5

The first, the third and the last row have an edge at 1, thus you can draw a line that crosses three bricks less than the height of the wall. You need to find the edge that appears the most.

In this case it would be four it appears in rows 2,3,5,6.

After transforming the wall to a wall of edges, a SelectMany into a GroupBy and Max will do the trick.

deleted 7 characters in body
Source Link

You could look at it in a different way, transform the wall of bricks to a wall of edges, in your example it would be

1, 3, 5
3, 4
1, 4
2
3, 4
1, 4, 5

The first, the third and the last rows have an edge at 1, thus you can draw a line that crosses three bricks less than the height of the wall. You need to find the edge that appearancesappears the most.

In this case it would be four it appearanceappears in rows 2,3,5,6.

After transforming the wall to a wall of edges, a SelectMany into a GroupBy and Max will do the trick.

You could look at it in a different way, transform the wall of bricks to a wall of edges, in your example it would be

1, 3, 5
3, 4
1, 4
2
3, 4
1, 4, 5

The first, the third and the last rows have an edge at 1, thus you can draw a line that crosses three bricks less than the height of the wall. You need to find the edge that appearances the most.

In this case it would be four it appearance in rows 2,3,5,6.

After transforming the wall to a wall of edges, a SelectMany into a GroupBy and Max will do the trick.

You could look at it in a different way, transform the wall of bricks to a wall of edges, in your example it would be

1, 3, 5
3, 4
1, 4
2
3, 4
1, 4, 5

The first, the third and the last rows have an edge at 1, thus you can draw a line that crosses three bricks less than the height of the wall. You need to find the edge that appears the most.

In this case it would be four it appears in rows 2,3,5,6.

After transforming the wall to a wall of edges, a SelectMany into a GroupBy and Max will do the trick.

added 152 characters in body
Source Link

You could look at it in a different way, transform the wall of bricks to a wall of edges, in your example it would be

1, 3, 5
3, 4
1, 4
2
3, 4
1, 4, 5

if you look atThe first, the middle column you are crossingthird and the 4thlast rows have an edge at 1, thus you can draw a line that iscrosses three bricks less than the edge after a total widthheight of 4 four times more than any otherthe wall. You need to find the edge that appearances the most.

height minus maximum edges that canIn this case it would be crossedfour it appearance in rows 2,3,5,6.

After transforming the wall to a column is your answerwall of edges, a SelectMany into a GroupBy and Max will do the trick.

You could look at it in a different way, transform the wall of bricks to a wall of edges, in your example it would be

1, 3, 5
3, 4
1, 4
2
3, 4
1, 4, 5

if you look at the middle column you are crossing the 4th edge, that is the edge after a total width of 4 four times more than any other.

height minus maximum edges that can be crossed in a column is your answer.

You could look at it in a different way, transform the wall of bricks to a wall of edges, in your example it would be

1, 3, 5
3, 4
1, 4
2
3, 4
1, 4, 5

The first, the third and the last rows have an edge at 1, thus you can draw a line that crosses three bricks less than the height of the wall. You need to find the edge that appearances the most.

In this case it would be four it appearance in rows 2,3,5,6.

After transforming the wall to a wall of edges, a SelectMany into a GroupBy and Max will do the trick.

added 2 characters in body
Source Link
Loading
deleted 1 character in body
Source Link
Loading
you forgot one edge
Source Link
t3chb0t
  • 44.7k
  • 9
  • 84
  • 190
Loading
Source Link
Loading