First working version of dynamic programming version of symmetry! I believe it runs in O(TW) time