sir pls explain this--> if we take list as [9,8,9]
@codetodesign7 ай бұрын
digits = [9, 8, 9] n = 3 First Iteration (i=2): digits[2] is incremented by 1: digits[2] = 9 + 1 = 10 Since digits[2] is 10 (which means there's a carry), digits[2] is set to 0. digits becomes [9, 8, 0]. Second Iteration (i=1): digits[1] is incremented by 1: digits[1] = 8 + 1 = 9 Since digits[1] is less than 10, no carry is generated, and the loop breaks. digits becomes [9, 9, 0]. Final State: The loop terminates because there is no further carry. The function returns [9, 9, 0]. I hope now its clear.
@ravikumargangula7 ай бұрын
@@codetodesign Tq sir
@CodeWithKushwaha8 ай бұрын
Plz do 500 leetcode problems in java, we really need it