Thursday, October 8, 2015

[20.13] largest possible rectangle of letters

1. Example

maximal square
maximal rectangle
maximal possible sum
maximum rectangle letter

Example
From catcarapeapireptip we get the following rectangle (which is a square):
c a r
a p e
t i p

2. Implementation




WordGroup[] groupList = WordGroup.createWordGroups(list);
private int maxWordLength = groupList.length;
private Trie trieList[] = new Trie[maxWordLength];





public Rectangle maxRectangle()
{
     int maxSize = maxWordLength*maxWordLength;
     // NOTE: area
     for ( int z = maxSize; z > 0; z-- ) {
         // NOTE: length
         for ( int i= 1; i <= maxWordLength;i++ ) {
                if (  z%i==0  )
                {
                       int j = z / i ;
                      
                }
         }
     }
     

}




private Rectangle makeRectangle(int length, int height)
{


}





private Rectangle makePartialRectangle(int l, int h, Rectangle rectangle)
{


}




1. each row must be the same length and each column must have the same length.
So, let’s group the words of the dictionary based on their sizes.Let’s call this grouping D, where D[i] provides a list of words of length i.

3. Similar Ones
https://github.com/monkeylyf/interviewjam/blob/master/recursion/cap_Words_Rectangle.java
http://stackoverflow.com/questions/8512174/largest-possible-rectangle-of-letters

No comments:

Post a Comment