MCPcopy Index your code
hub / github.com/neetcode-gh/leetcode / plusOne

Function plusOne

javascript/0066-plus-one.js:7–13  ·  view source on GitHub ↗
(digits)

Source from the content-addressed store, hash-verified

5 * @return {number[]}
6 */
7var plusOne = (digits) => {
8 add(digits);
9 carry(digits); /* Time O(N) */
10 addLeading(digits); /* | Space O(N) */
11
12 return digits;
13};
14
15var add = (digits) => (digits[digits.length - 1] += 1);
16

Callers

nothing calls this directly

Calls 3

carryFunction · 0.85
addLeadingFunction · 0.85
addFunction · 0.70

Tested by

no test coverage detected