Brute force:
(\:*/"1);<@:((#,<./)\.)\2 6 7 4 1 7
2 6
3 4
4 2
2 4
1 7
1 7
1 6
3 2
6 1
5 1
5 1
2 2
1 4
4 1
4 1
3 1
3 1
1 2
2 1
2 1
1 1
Though the complexity looks like n^3 to me. There must be a more efficient
algorithm.
> On Jun 20, 2017, at 10:29 AM, Raul Miller <[email protected]> wrote:
>
> Something I stumbled over today.
>
> If we have a series of bars of varying height, what's the largest
> rectangle that can be drawn over the bars without covering any empty
> space.
>
> For example:
>
> '*'#"0~2 6 7 4 1 7
> **
> ******
> *******
> ****
> *
> *******
>
> I'll post a solution later, and I'll be interested in seeing if it's
> basically the only obvious approach or if there's a variety of good
> approaches. (I have reason to believe, though, that there's a better
> way than what I came up with.)
>
> Thanks,
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm