Algorithm · ByteDance · Easy
You are given a non-empty array of decimal digits that encodes a non-negative whole number. Add one to that number. The first array entry holds the highest-place digit, and every entry stores exactly one digit. Apart from the value 0 itself, the represented number will not begin with zero. Input Format A non-empty array digits that encodes a non-negative integer. Output Format Return an array encoding the value represented by the input after adding one. Example Input:…
Checking your access…