dynamic prog problem
bitwise