dynamic programming
 
Socks