Skip to content

Commit 7c6abc0

Browse files
committed
working...
1 parent a28eb42 commit 7c6abc0

6 files changed

+23
-8
lines changed

add-two-numbers.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* @return {ListNode}
1212
*/
1313

14+
// https://leetcode.com/problems/add-two-numbers/
15+
1416
function ListNode(val, next) {
1517
this.val = val === undefined ? 0 : val;
1618
this.next = next === undefined ? null : next;

find-original-array-from-doubled-array.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* @param {number[]} changed
33
* @return {number[]}
44
*/
5+
6+
// https://leetcode.com/problems/find-original-array-from-doubled-array/
7+
58
var findOriginalArray = function (changed) {
69
if (changed.length % 2 !== 0) return [];
710
let result = [];

merge-two-sorted-lists.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* @return {ListNode}
1212
*/
1313

14+
// https://leetcode.com/problems/merge-two-sorted-lists/
15+
1416
function ListNode(val, next) {
1517
this.val = val === undefined ? 0 : val;
1618
this.next = next === undefined ? null : next;

remove-duplicates-from-sorted-list.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
* @param {ListNode} head
1010
* @return {ListNode}
1111
*/
12+
13+
// https://leetcode.com/problems/remove-duplicates-from-sorted-list/
14+
1215
var deleteDuplicates = function (head) {
1316
const listnode = new ListNode(null);
1417
let prev = listnode;

two-sum.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
* @return {number[]}
55
*/
66

7-
var twoSum = function(nums, target) {
8-
const hashMap = {};
7+
// https://leetcode.com/problems/two-sum/
98

10-
for (let i = 0; i< nums.length; i++) {
11-
const num = nums[i];
12-
if ( hashMap[num] >= 0 ) {
13-
return [hashMap[num], i];
14-
}
15-
hashMap [target - num] = i;
9+
var twoSum = function (nums, target) {
10+
const hashMap = {};
11+
12+
for (let i = 0; i < nums.length; i++) {
13+
const num = nums[i];
14+
if (hashMap[num] >= 0) {
15+
return [hashMap[num], i];
1616
}
17+
hashMap[target - num] = i;
18+
}
1719
};

valid-parentheses.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* @param {string} s
33
* @return {boolean}
44
*/
5+
6+
// https://leetcode.com/problems/valid-parentheses/
7+
58
var isValid = function (s) {
69
const match = {
710
"{": "}",

0 commit comments

Comments
 (0)