摘要:
1 var threeSumClosest = function(nums, target) { 2 if (nums.length target) {32 r--;33 } else {34 ... 阅读全文
摘要:
1 var threeSum = function(nums) { 2 var res = [], 3 i, l, r, sum; 4 5 if (nums.length 0) {25 r--;26 } e... 阅读全文
摘要:
1 var longestCommonPrefix = function(strs) { 2 if (strs.length < 1) { 3 return ""; 4 } 5 6 var prefix = strs[0]; 7 8 for (v... 阅读全文
摘要:
1 var roman = { 2 "I": 1, 3 "V": 5, 4 "X": 10, 5 "L": 50, 6 "C": 100, 7 "D": 500, 8 "M": 1000 9 };10 11 var romanToInt = ... 阅读全文
摘要:
1 /** 2 * Definition for singly-linked list. 3 * function ListNode(val) { 4 * this.val = val; 5 * this.next = null; 6 * } 7 */ 8 /** 9 ... 阅读全文
摘要:
1 var fourSum = function(nums, target) { 2 if (nums.length i + 1 && nums[j] === nums[j - 1]) {23 continue;24 }25 26 ... 阅读全文
摘要:
1 var arr = [ 2 [], 3 [], 4 ['a', 'b', 'c'], 5 ['d', 'e', 'f'], 6 ['g', 'h', 'i'], 7 ['j', 'k', 'l'], 8 ['m', 'n', 'o'], ... 阅读全文
摘要:
1 var addTwoNumbers = function(l1, l2) { 2 var sum = l1.val + l2.val, 3 l3 = new ListNode(sum % 10), 4 node = l3; 5 6 l1 = l... 阅读全文
摘要:
1 /** 2 * Definition for singly-linked list. 3 * function ListNode(val) { 4 * this.val = val; 5 * this.next = null; 6 * } 7 */ 8 /** 9 ... 阅读全文
摘要:
1 /** 2 * @param {string} s 3 * @return {boolean} 4 */ 5 var isValid = function(s) { 6 var stack = []; 7 8 for (var i = 0; i < s.length; ... 阅读全文