목록알고리즘/LeetCode (7)
어흥
문제 링크: https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/description/?envType=study-plan-v2&envId=top-100-liked LeetCode - The World's Leading Online Programming Learning Platform 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 1. 주의할 점 - 재귀문으로 접근하며, re..
문제 링크: https://leetcode.com/problems/find-the-duplicate-number/description/?envType=study-plan-v2&envId=top-100-liked Find the Duplicate Number - LeetCode Can you solve this real interview question? Find the Duplicate Number - Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repea..
문제 링크: https://leetcode.com/problems/max-number-of-k-sum-pairs/description/?envType=study-plan-v2&envId=leetcode-75 Max Number of K-Sum Pairs - LeetCode Can you solve this real interview question? Max Number of K-Sum Pairs - You are given an integer array nums and an integer k. In one operation, you can pick two numbers from the array whose sum equals k and remove them from the array. Return the..
문제 링크: https://leetcode.com/problems/product-of-array-except-self/description/?envType=list&envId=rdlarbki Product of Array Except Self - LeetCode Can you solve this real interview question? Product of Array Except Self - Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i]. The product of any prefix or suffix ..
문제 링크: https://leetcode.com/problems/lru-cache/description/ LRU Cache - LeetCode Can you solve this real interview question? LRU Cache - Design a data structure that follows the constraints of a Least Recently Used (LRU) cache [https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU]. Implement the LRUCache class: * LRUCache(int c leetcode.com 1. 주의할 점 - DoubleLinkedList와 HashMap을 사용 및 구현 할..
문제 링크: 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 1. 순열의 순서는 어떻게 정해질까?에 대한 의문을 직접 구..
문제 링크: https://leetcode.com/problems/zigzag-conversion/ Zigzag Conversion - 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 1. 주의할 점 - 큰 2차원 배열을 사용하지 않는다(Ex. 1시 방향으로 올라갈때 우측 1칸, 위로 1칸) → 메모리 절약 - numRows의 값에 따라 패턴 길이를 구한다 2. 구현 - String[] 배열에 문자들을 추가하는 방식으로 구현한다 - 몇 개를 기준으로 각 문자열이 ..