$f = 0
$tmp = Array.new
$res = Array.new
def combination_sum3(k, n)
if (k > 9) or (k < 1) or (n > 9) or (n < 1) return $res end f = $f + 1 if (n < (2 * f + k - 1 ) * k / 2) && (k != 1 ) return $res end if k != 1 for i in f .. n/k do $f = i $tmp << i combination_sum3(k - 1, n - i) $tmp.pop end elsif n > $tmp[-1] $tmp << n $res << $tmp.clone $tmp.pop end
end
Runtime Error Message: Line 48: in `block in _driver'
小白,初用LeetCode和segmentfault
Maybe there is something wrong with the input format you entered
Do not directly copy the input in the question