SW개발/코딩테스트
[LeetCode]Jump Game II
https://leetcode.com/problems/jump-game-ii/description/ Jump Game II - LeetCode Can you solve this real interview question? Jump Game II - You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0]. Each element nums[i] represents the maximum length of a forward jump from index i. In other wo leetcode.com 문제 분석 nums 리스트에는 한번에 점프할 수 있는 최대의 값이 들어 있습니다. 목적..
[LeetCode]Combination Sum
https://leetcode.com/problems/combination-sum/description/ Combination Sum - LeetCode Can you solve this real interview question? Combination Sum - Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the comb leetcode.com 문제 분석 주어진 숫자를 더해서 target 값을 만들어 낼 수 있는 숫자 ..
[LeetCode]Find First and Last Position of Element in Sorted Array
https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ Find First and Last Position of Element in Sorted Array - LeetCode Can you solve this real interview question? Find First and Last Position of Element in Sorted Array - Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is no..
[LeetCode]Search in Rotated Sorted Array
https://leetcode.com/problems/search-in-rotated-sorted-array/ Search in Rotated Sorted Array - LeetCode Can you solve this real interview question? Search in Rotated Sorted Array - There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 int: left = 0 right = len(nums)-1 while ..
[LeetCode]Next Permutation
https://leetcode.com/problems/next-permutation/description/ Next Permutation - LeetCode Can you solve this real interview question? Next Permutation - A permutation of an array of integers is an arrangement of its members into a sequence or linear order. * For example, for arr = [1,2,3], the following are all the permutations of arr: [1,2,3], leetcode.com 문제 분석 숫자가 주어졌을 때 다음 순열을 찾는 문제입니다. 처음 시도한..
[LeetCode]Linked List Cycle
https://leetcode.com/problems/linked-list-cycle/ Linked List Cycle - LeetCode Can you solve this real interview question? Linked List Cycle - Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again by continuo leetcode.com 문제 분석 주어진 링크드 리스트에 사이클이 존재하는지 여부를 구하는 문제입니다. 처음 시도..
[LeetCode]Single Number
https://leetcode.com/problems/single-number/ Single Number - LeetCode Can you solve this real interview question? Single Number - Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with a linear runtime complexity and use only constant leetcode.com 문제 분석 주어진 nums 리스트에서 한번만 등장하는 숫자를 찾는 문제입니다. 처음 시도한 답안 class So..
[LeetCode]Best Time to Buy and Sell Stock
https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ Best Time to Buy and Sell Stock - LeetCode Can you solve this real interview question? Best Time to Buy and Sell Stock - You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosin leetcode.com 문제 분석 주식에 대한 가격이 주어졌을 ..
[LeetCode]Swap Nodes in Pairs
https://leetcode.com/problems/swap-nodes-in-pairs/ Swap Nodes in Pairs - LeetCode Can you solve this real interview question? Swap Nodes in Pairs - Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be chan leetcode.com 문제 분석 서로 인접해있는 노드를 뒤집는 문제입니다. 단, 값을 바꾸는 것이 아니라 링..
[LeetCode]Generate Parentheses
https://leetcode.com/problems/generate-parentheses/description/ Generate Parentheses - LeetCode Can you solve this real interview question? Generate Parentheses - Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] Exa leetcode.com 문제 분석 주어진 n개의 괄호를 가지고 가능한 괄호의 조합을 모..