Condition to check if number of previous continuous columns left unpainted is less than P
if ( prevCol + 1 < P ) : NEW_LINE INDENT res += ( ( helper ( col + 1 , prevCol + 1 , painted , 0 , N , P , K ) ) % mod ) NEW_LINE DEDENT