unset the bit at currentIndex
$ noOfWays += waysToKAdjacentSetBits ( $ n , $ k , $ currentIndex + 1 , $ adjacentSetBits , 0 ) ; } else if ( ! $ lastBit ) { $ noOfWays += waysToKAdjacentSetBits ( $ n , $ k , $ currentIndex + 1 , $ adjacentSetBits , 1 ) ; $ noOfWays += waysToKAdjacentSetBits ( $ n , $ k , $ currentIndex + 1 , $ adjacentSetBits , 0 ) ; } return $ noOfWays ; }