<s>[INST] This problem is the same as Text Justification:Full Justification in LeetCode, but I need to solve it by DP.
The problem is as follows:
Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified.

You should pack your words in a greedy approach; that is, pack as many words as you can in every line. Put extra spaces evenly between words and add extra spaces when necessary.

Here is an example:

words = ["This", "is", "an", "example", "of", "text", "justification."]
maxWidth = 16
The correctly formatted text is:

"This  is  an"
"example  of text"
"justification.  "

Note that the extra spaces added should be as evenly spaced as possible. If the number of spaces on a line do not divide evenly between words, add the extra spaces to the left, between the words. Both the first and the last lines should be left-justified.

Here is my code that I am using (The idea for using the code from this page: https://massivealgorithms.blogspot.com/2019/02/the-lintcode-full-justification-and-text.html):

```java
public class Solution {
    public List<String> fullJustify(String[] words, int maxWidth) {
        List<String> res = new ArrayList<>();
        for(int i = 0; i < words.length; i++) {
            int j = i, len = words[i].length();
            for(j = i + 1; j < words.length; j++) {
                len += words[j].length() + 1;
                if(len > maxWidth) break;
            }

            int diff = maxWidth - (len - (j - i));
            int n = j - i;
            if(j == words.length || n == 1) {
                // last line or one word per line
                while(diff-- > 0) {
                    res.add(words[--j] + " ");
                }
                res.add(words[--j]);
            } else {
                int x = diff / (n - 1);
                int y = diff % (n - 1);
                for(int a = 0; a < n; a++) {
                    res.add(words[j - a - 1]);
                    int spcnt = x + (a < y?[/INST]