반응형 알고리즘23 [LeetCode] 611. Valid Triangle Number | LIM 문제 https://leetcode.com/problems/valid-triangle-number/description/ Valid Triangle Number - LeetCode Can you solve this real interview question? Valid Triangle Number - Given an integer array nums, return the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle. Example 1: Input: nums = [2,2,3,4 leetcode.com Given an integer array nums, r.. 2023. 5. 29. [LeetCode] 118. Pascal's Triangle | LIM 문제 https://leetcode.com/problems/pascals-triangle/description/ Pascal's Triangle - LeetCode Can you solve this real interview question? Pascal's Triangle - Given an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it as shown: [https://upload.wikimedia.o leetcode.com Given an integer numRows, return the.. 2023. 5. 28. [LeetCode] 561. Array Partition | LIM 문제 https://leetcode.com/problems/array-partition/ Array Partition - LeetCode Can you solve this real interview question? Array Partition - Given an integer array nums of 2n integers, group these integers into n pairs (a1, b1), (a2, b2), ..., (an, bn) such that the sum of min(ai, bi) for all i is maximized. Return the maximized sum. leetcode.com Given an integer array nums of 2n integers, group t.. 2023. 5. 27. [LeetCode] 1143. Longest Common Subsequence | LIM 문제 https://leetcode.com/problems/longest-common-subsequence/ Longest Common Subsequence - LeetCode Can you solve this real interview question? Longest Common Subsequence - Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0. A subsequence of a string is a new string genera leetcode.com Given two strings text1 and t.. 2023. 5. 26. [LeetCode] 300. Longest Increasing Subsequence | LIM 문제 https://leetcode.com/problems/longest-increasing-subsequence/description/ Longest Increasing Subsequence - LeetCode Can you solve this real interview question? Longest Increasing Subsequence - Given an integer array nums, return the length of the longest strictly increasing subsequence. Example 1: Input: nums = [10,9,2,5,3,7,101,18] Output: 4 Explanation: The longest leetcode.com Given an int.. 2023. 5. 16. [LeetCode] 3. Longest Substring Without Repeating Characters | LIM 문제 https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ 포인터를 이동할 때 i는 기존에 있던 칸에서 한칸 오른쪽으로 이동, j의 경우 i 다음칸으로 이동 그림으로 보면 이러하다. 코드 from collections import defaultdict class Solution: def lengthOfLongestSubstring(self, s: str) -> int: sub = defaultdict(int) i, j = 0, 1 max_len = 0 if not len(s): return 0 sub[s[0]] = 1 while j < len(s): if not sub[s[j]]: sub[s[j]].. 2023. 5. 7. 이전 1 2 3 4 다음 반응형