wedding problem - dp