Welcome to Weekly Contest 226! Feel free to share and post your contest experience here! You can also view the rankings for the contest here. Links to the individual problems are included below: Maximum Number of Balls in a Box (3 points) Restore the Array From Adjacent Pairs (4 points) Can You Eat Your Favorite Candy on Your Favorite Day? (5 points) Palindrome Partitioning IV (6 points) leetcod..
leetcode.com/contest/biweekly-contest-44 Welcome to Biweekly Contest 44! Feel free to share and post your contest experience here! You can also view the rankings for the contest here. Links to the individual problems are included below: Find the Highest Altitude (3 points) Minimum Number of People to Teach (4 points) Decode XORed Permutation (5 points) Count Ways to Make Array With Product (6 po..
Hello everyone, We've taken into account your comments and critique. After multiple rounds of testing and debate, we've finalized the details for our new rating algorithm. The calculations behind the new algorithm will be left unchanged from the previous discussion. As a reminder, they were listed here: 👉 New Rating Algorithm Previously, we had discussed the possibility of having contest seasons..
leetcode.com/contest/weekly-contest-224/ Welcome to Weekly Contest 224! Feel free to share and post your contest experience here! You can also view the rankings for the contest here. Links to the individual problems are included below: Number Of Rectangles That Can Form The Largest Square (3 points) Tuple with Same Product (4 points) Largest Submatrix With Rearrangements (5 points) Cat and Mouse..
leetcode.com/contest/weekly-contest-223 Welcome to Weekly Contest 223! Feel free to share and post your contest experience here! You can also view the rankings for the contest here. Links to the individual problems are included below: Decode XORed Array (3 points) Swapping Nodes in a Linked List (4 points) Minimize Hamming Distance After Swap Operations (5 points) Find Minimum Time to Finish All..
leetcode.com/contest/weekly-contest-222 222 9692 4096 1594 664 247 42.26% 16.45% 6.85% 2.55% 12.58% My 2021 is ruined :( TLE for both q2 and q3 1710. Maximum Units on a Truck leetcode.com/problems/maximum-units-on-a-truck/ class Solution: def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int: boxTypes.sort(key=lambda x: -x[1]) max_units = 0 for n, units in boxTypes: max_units ..
leetcode.com/contest/weekly-contest-210 1614. Maximum Nesting Depth of the Parentheses leetcode.com/problems/maximum-nesting-depth-of-the-parentheses/ def maxDepth(self, s): res = cur = 0 for c in s: if c == '(': cur += 1 res = max(res, cur) if c == ')': cur -= 1 return res 괄호문제는 보통 스택이 필요할것 같지만, 잘 생각해보면 필요없다. 그리고 아래의 조건 때문에, 짝이 안맞는것을 디텍팅할 필요도 없다. 문제를 잘 읽자. For example, "", "()()", and "()(()())..
leetcode.com/contest/weekly-contest-211 1624. Largest Substring Between Two Equal Characters leetcode.com/problems/largest-substring-between-two-equal-characters/ 문제를 잘읽자, 없으면 -1을 반환하라고 되있으니. class Solution: def maxLengthBetweenEqualCharacters(self, s: str) -> int: dic = {} max_len = -1 for i in range(len(s)): if s[i] in dic: max_len = max(max_len, i - dic[s[i]] - 1) else: dic[s[i]] = i return m..
leetcode.com/contest/weekly-contest-212 leetcode.com/problems/slowest-key/ class Solution: def slowestKey(self, releaseTimes: List[int], keysPressed: str) -> str: #Time complexity = O(n) #Space complexity = O(1) maxletter = keysPressed[0] maxvalue = releaseTimes[0] for i in range(1, len(releaseTimes)): value = releaseTimes[i] - releaseTimes[i-1] if value > maxvalue: maxvalue = value maxletter = ..
leetcode.com/contest/weekly-contest-221/ 1704. Determine if String Halves Are Alike leetcode.com/problems/determine-if-string-halves-are-alike/ You are given a string s of even length. 라고 했는데 복잡하게 홀수 처리 하고 있었네. 문제를 잘읽자. class Solution: def halvesAreAlike(self, s: str) -> bool: vowels = set(['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']) i = 0 j = len(s)-1 cnt_i = cnt_j = 0 while i < j: if s[..
leetcode.com/contest/weekly-contest-220 class Solution: def reformatNumber(self, number: str) -> str: ans = "" chunk = "" for n in number: if n.isdigit(): chunk += n if len(chunk) % 3 == 0: if len(ans) != 0: ans += '-' ans += chunk chunk = "" if len(chunk) == 1: chunk = ans[-1] + chunk ans = ans[:-1] if len(chunk) > 0: if len(ans) != 0: ans += '-' ans += chunk return ans 1695. Maximum Erasure Va..
leetcode.com/contest/biweekly-contest-42. leetcode.com/problems/number-of-students-unable-to-eat-lunch/ 문제에 기술된 그대로의 코드 class Solution: def countStudents(self, students: List[int], sandwiches: List[int]) -> int: n = len(students) ans = n start = 0 for sandwich in sandwiches: found = False print(start, start+n) for i in range(start, start+n): idx = i % n start = (idx+1)%n if students[idx] == sand..
leetcode.com/contest/weekly-contest-219 leetcode.com/problems/count-of-matches-in-tournament/ class Solution { public int numberOfMatches(int n) { int round = 0; while(n != 1) { round += n/2; n = n/2+n%2; } return round; } } 빵터짐 ㅋㅋ leetcode.com/problems/count-of-matches-in-tournament/ class Solution { public int minPartitions(String n) { int maximum = 0; for(int i = 0; i < n.length(); i++) { max..
leetcode.com/contest/biweekly-contest-41 1684. Count the Number of Consistent Strings https://leetcode.com/problems/count-the-number-of-consistent-strings/ 굳이 set 까지 쓸 필요 있을까? class Solution { public int countConsistentStrings(String allowed, String[] words) { boolean[] flag = new boolean[26]; int cnt = 0; for(char ch : allowed.toCharArray()) flag[ch-'a'] = true; for(String word : words) { boole..
leetcode.com/contest/weekly-contest-214 Contest - 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 두문제는 합쳐서 30분안에 풀수있었으나 그 다음 두문제 너무 어려웠다. leetcode.com/problems/sell-diminishing-valued-colored-balls/ Sell Diminishing-Valued Colored Balls - LeetCode Level up your coding skills and qu..
leetcode.com/contest/weekly-contest-218 Contest - 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번 leetcode.com/problems/goal-parser-interpretation/ Goal Parser Interpretation - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your kno..
leetcode.com/contest/weekly-contest-215 Contest - 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 1656. Design an Ordered Stream class OrderedStream { String[] streamList; int ptr; public OrderedStream(int n) { streamList = new String[n]; ptr = 0; } public List insert(int id, Strin..
leetcode.com/contest/weekly-contest-217 Contest - 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 leetcode.com/problems/richest-customer-wealth/ Richest Customer Wealth - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge an..
leetcode.com/contest/biweekly-contest-40 Contest - 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 4개는 언제 풀수있을까...ㅜ
나는 최근에 이상한 일을 하고 있다. 예전의 나와 경쟁... 오늘은 2019년 2월 10일 나와의 경쟁. leetcode.com/contest/weekly-contest-123 Contest - 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 class Solution { public List addToArrayForm(int[] A, int K) { int n = A.length; int c = K; for(int i = A.length-1;i >= 0;i--)..
leetcode.com/contest/weekly-contest-191 Contest - 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 실력이 좀 늘었나? 하고 생각했지만, 3문제가 워낙 쉬웠던것 같다. leetcode.com/contest/weekly-contest-191/ranking/161/ Contest - LeetCode Level up your coding skills and quickly land a job. This is the best place..
leetcode.com/contest/weekly-contest-122/ Contest - 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 드디어 3문제 풀었다. 근데이번에 좀 쉬운편인듯 leetcode.com/contest/weekly-contest-122/problems/vertical-order-traversal-of-a-binary-tree/
1번과 2번을 푸는데, 고수는 5분/5분 중수는 10분/10분 정도 걸린듯함. leetcode.com/problems/check-array-formation-through-concatenation/ Check Array Formation Through Concatenation - 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 Approach 1: One by One 코드가 예쁜편 class Solution { public boolean canFormArray(i..