2. Add Two Numbers
·
Javascript/LeetCode
Add Two Numbers 문제는 2개의 Linked List의 합을 구하는 문제입니다. 각 Node에는 0~9 값이 있고, 자리수가 1의 자리부터 증가 합니다. 문제는 간단히 한자리씩 더하면서 노드를 만들어 나가면 되는 문제입니다. 단, 처음부터 Number형으로 변경하여 계산 시 Overflow에 빠질 수 있으니 유의해야 합니다. * Problem You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and retur..
1. Two Sum
·
Javascript/LeetCode
최근 직장동료들과 함께 LeetCode를 하루 한 문제씩 도전하고 있습니다. 어려운 문제도, 쉬운문제도 있는데 오랜만에 20대 때의 마음을 가지고 편하게 즐겁게 임하고 있습니다. Two Sum 문제는 매우 쉽지만, 2가지 정도로 해결할 수 있을 것 같습니다. 문제를 먼저 살펴보겠습니다. * 문제 살펴보기 Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twic..