LeetCode 2. Add Two Numbers - C++
Algorithm/PS2024. 2. 13. 21:36LeetCode 2. Add Two Numbers - C++

문제 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 return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. 두 개의 양의 정수를 나타내는 비어 있지 않은 두 개의 연결 리스트가 제공된다. 숫자는 역순으로 저장되며, 각 노드에는 단일 숫자가 포함..

LeetCode 1. Two Sum - C++
Algorithm/PS2024. 2. 13. 21:10LeetCode 1. Two Sum - C++

문제 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 twice. You can return the answer in any order. 예제 Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we return [0, ..

image