All problems
Rational Function Limit at Infinity
Problem
For a rational function num(x) / den(x), the limit at infinity depends on the degrees: 0.0 when the denominator degree is larger, the ratio of leading coefficients when they match, and None when the numerator degree is larger (the limit diverges).
Given coefficient lists in ascending order, return the limit or None.
Hint
Compare the highest nonzero degrees, then the leading coefficients.
Test cases
case 1
in: [[1,2],[1,0,1]]
expected: 0
case 2
in: [[3,0,2],[1,1]]
expected: null
case 3
in: [[5,1,0,0],[2,1]]
expected: 1
Starter codePython
def rational_limit_at_infinity(num, den):
# Your code here
pass3 test cases · run your code against them in the editor