Skip to content

[2] Add two numbers#98

Open
SooJungChae wants to merge 1 commit into
feature/leetcodefrom
leetcode-2
Open

[2] Add two numbers#98
SooJungChae wants to merge 1 commit into
feature/leetcodefrom
leetcode-2

Conversation

@SooJungChae
Copy link
Copy Markdown
Owner

다른 사람이 한거 가져온건데 해석해보기

Copy link
Copy Markdown
Owner Author

@SooJungChae SooJungChae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

의문점

*/
var addTwoNumbers = function(l1, l2) {
let node = null;
const carry = arguments[2];
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

반올림 하는경우

const next2 = l2 ? l2.next : null;
const val = carry ? val1 + val2 + 1 : val1 + val2;
node = new ListNode(val % 10);
node.next = addTwoNumbers(next1, next2, val >= 10);
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

왜 이 경우 node list 가 되는거지??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant