private int solve() {
		int maxScore = 0;
		for (int i = 2; i <= myWords.length; i++) {
			int power = 1;
			for (int lastWordIndex = 0; lastWordIndex < myWords.length; lastWordIndex++) {
				for (int j = 1; j < prevDpState[0].length; j++) { // mask
					if ((j & power) != 0) {
						int previousMask = ~power & j; // make kth bit 0
						int score = bestArrangement(previousMask, lastWordIndex);
						dpState[lastWordIndex][j] = score;
					}
				}
				power *= 2;
			}
			prevDpState = dpState;
			dpState = createDpState();
		}
		int finalMask = (int) Math.pow(2, myWords.length) - 1;
		for (int i = 0; i < myWords.length; i++)
			if (prevDpState[i][finalMask] > maxScore)
				maxScore = prevDpState[i][finalMask];
		return maxScore;
	}