LeetCode - Two Sum II - Input Array Is Sorted https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/ Two Sum II - Input Array Is Sorted - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /** * @param {number[]} numbers * @param {number} target * @return {number[]} */ var twoSum = function(numbers, target) { let l = 0; .. Algorithm/LeetCode 3년 전
LeetCode - Two Sum /** * @param {number[]} nums * @param {number} target * @return {number[]} */ var twoSum = function(nums, target) { for(let i = 0 ; i < nums.length; i++){ for(let j = 0 ; j < nums.length; j++){ if(i==j) continue; if(nums[i]+nums[j]==target){ return [i,j]; } } } }; 1. 두 수를 더해서 맞으면 리턴한다. Algorithm/LeetCode 3년 전
LeetCode - Add Two Numbers https://leetcode.com/problems/add-two-numbers/ Add Two Numbers - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /** * Definition for singly-linked list. * function ListNode(val, next) { * this.val = (val===undefined ? 0 : val) * this.next = (next===undefined ? null : next) * } */ .. Algorithm/LeetCode 3년 전
LeetCode - Triangle https://leetcode.com/problems/triangle/ Triangle - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /** * @param {number[][]} triangle * @return {number} */ var minimumTotal = function(triangle) { let n = triangle.length; for(let i = 1 ; i Algorithm/LeetCode 3년 전
LeetCode - Best Time to Buy and Sell Stock II https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/ Best Time to Buy and Sell Stock II - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /** * @param {number[]} prices * @return {number} */ var maxProfit = function(prices) { let max = 0; for(let i= 0 ; i Algorithm/LeetCode 3년 전
LeetCode - Jump Game II https://leetcode.com/problems/jump-game-ii/ Jump Game II - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /** * @param {number[]} nums * @return {number} */ var jump = function(nums) { let cnt = 0; let index = 0; let dest = nums.length-1; while(index< dest){ let a= nums[index]; if.. Algorithm/LeetCode 3년 전