75. implement BigInt subtraction

JavaScriptAlgorithm
Is this helpful ?

from all members: - accepted / - tried

Luckily we already have built-in support of BigInt in JavaScript, at least in some browsers.

1000000000000000000000n - 999999999999999999999n
// 1n

Suppose BigInt cannot be used, can you implement a string subtraction function by yourself?

subtract('1000000000000000000000', '999999999999999999999')
// '1'

All input are valid non-negative integer strings, and the result is guaranteed to be non-negative.

Don't use BigInt directly, it is not our goal here

Let's try to solve this problem within 20 mintues.

Discuss(7)