Input ==== A list of lists of letters like: ["B", "C", "C", "C", "C", "B", "B", "C", "A", "A"], ["B", "A", "C", "B", "B", "A", "B", "B", "A", "A"], ["B", "C", "B", "C", "A", "A", "A", "B", "C", "B"], ["B", "B", "B", "A", "C", "B", "A", "C", "B", "A"], ["A", "A", "A", "C", "A", "C", "C", "B", "A", "C"], ["A", "B", "B", "A", "A", "C", "B", "C", "C", "C"], ["C", "B", "A", "A", "C", "B", "B", "C", "A", "A"] Rules === * To make a valid rectangle you need all rectangle corners of the same color. * Example, look the *sample board with* **X** bellow. You can see 'X' on (1,0) also on (4,0) also on ( 1,3) and on (4,3) then you have the rectange [1,0,4,3] that means from (1,0) to (4,3): *Sample board with* **X**: ["B", "X", "C", "C", "X", "B", "B", "C", "A", "A"], ["B", "A", "C", "B", "B", "A", "B", "B", "A", "A"], ["B", "C", "B", "C", "A", "A", "A", "B", "C", "B"], ["B", "X", "B", "A", "X", "B", "A", "C", "B", "A"], ["A", "A", "A", "C", "A", "C", "C", "B", "A", "C"], ["A", "B", "B", "A", "A", "C", "B", "C", "C", "C"], ["C", "B", "A", "A", "C", "B", "B", "C", "A", "A"] * The goal is to found the valid rectangle with the largest **area** Output ==== The output should be the left-up and right-down positions of the largest area rectangle corners. For the first sample "board" the big square is the yellow one: [![enter image description here][1]][1] And the answer should be: > [1, 1, 8, 4] This question is posted on Stack Overflow with title: [How to find the largest rectangle in a 2D array formed by four identical corners?][2] and with this rude JS solution (I can say "rude" because is my code ;) : Ok, is my first post, be tolerant with me please. I will change all you say to improve the quiz. [1]: https://i.sstatic.net/ZIkkF.png [2]: https://stackoverflow.com/questions/49708412/how-to-find-the-largest-rectangle-in-a-2d-array-formed-by-four-identical-corners