If it is a valiINT_MAXd move then update the minimum steps required
if ( i + k < n && str . charAt ( i + k ) == '1' ) steps = Math . min ( steps , dp [ i + k ] ) ; if ( str . charAt ( i + 1 ) == '1' ) steps = Math . min ( steps , dp [ i + 1 ] ) ; if ( str . charAt ( i + 2 ) == '1' ) steps = Math . min ( steps , dp [ i + 2 ] ) ;