본문 바로가기
728x90

LeetCode22

[LeetCode | Java | Queue 문제 풀이] 933. Number of Recent Calls - Solution with ArrayList & Stream API 99 Club 2기 | Java | Beginner🤙 Number of Recent Calls🏷 관련 주제 : Design Queue Data StreamEasy ✔ Solution with ArrayList & Stream APIimport java.util.ArrayList;class RecentCounter { ArrayList recentCounter; public RecentCounter() { recentCounter = new ArrayList(); } public int ping(int t) { recentCounter.add(t); int answer = (int) recentCounter.stream().f.. 2024. 6. 23.
[LeetCode | Java | Array, Stack, Queue 문제 풀이] 1700. Number of Students Unable to Eat Lunch - Solution with Queue 또는 Counting 99 Club 2기 | Java | Beginner🥪 1700. Number of Students Unable to Eat Lunch🏷 관련 주제 : Array Stack Queue SimulationEasy✔ Solution with Queueimport java.util.LinkedList;import java.util.Queue;import java.util.Arrays;import java.util.stream.Collectors;class Solution { public int countStudents(int[] students, int[] sandwiches) { Queue q = new LinkedList(Arrays.stream(students).boxed().coll.. 2024. 6. 22.
[LeetCode | Java | Array, Sorting 문제 풀이] 2089. Find Target Indices After Sorting Array - Solution with Loop 또는 Stream API 99 Club 2기 | Java | Beginnerℹ️ 2089. Find Target Indices After Sorting Array🏷 관련 주제 : Array Binary Search SortingEasy✔ Solution with Sorting & Loopimport java.util.Arrays;import java.util.List;import java.util.ArrayList;class Solution { public List targetIndices(int[] nums, int target) { List answer = new ArrayList(); Arrays.sort(nums); for (int i = 0; i 채점 결과✔ Solution .. 2024. 6. 21.
[99클럽] 99클럽 코테 스터디 32일차 TIL + Array, Sorting 👈  이전글[99클럽] 99클럽 코테 스터디 31일차 TIL + Array, char, int, 형 변환99Club 2기 | Java | Beginner🗝 오늘의 학습 키워드 : Array Sorting Hash Table Divide and Conquer Heap (Priority Queue) Bucket Sort Counting Quickselect Math Geometry Number Theory📚 공부한 내용 본인의 언어로 정리하기비기너 (🙋‍ 내가 발표 🎤) : 2733. Neither Minimum nor Maximum class Solution { public int findNonMinOrMax(int[] nums) { int answer = -1; A.. 2024. 6. 20.
[LeetCode | Java | Array, String 문제 풀이] 1773. Count Items Matching a Rule - Solution with Loop 99 Club 2기 | Java | Beginner🚩 1773. Count Items Matching a Rule🏷 관련 주제 : Array StringEasy You are given an array items, where each items[i] = [$type_{i},\ color_{i},\ name_{i}$] describes the type, color, and name of the $i^{th}$ item. You are also given a rule represented by two strings, ruleKey and ruleValue.The $i^{th}$ item is said to match the rule if one of the following is true:ruleKey.. 2024. 6. 17.
[LeetCode | Java | Array, String 문제 풀이] 2942. Find Words Containing Character - Solution with cotains() 99 Club 2기 | Java | Beginner🈶 2942. Find Words Containing Character🏷 관련 주제 : Array String contains()EasyYou are given a 0-indexed array of strings words and a character x.Return an array of indices representing the words that contain the character x.Note that the returned array may be in any order.Example 1:Input: words = ["leet","code"], x = "e"Output: [0,1]Explanation: "e" occurs in both wor.. 2024. 6. 16.
[LeetCode | Java | 주제 문제 풀이] 1512. Number of Good Pairs - Solution with 1)HashMap 2)Array 3)Stream API 99 Club 2기 | Java | Beginner1512. Number of Good Pairs🏷 관련 주제 : Array Hash Table Math CountingEasyGiven an array of integers nums, return the number of good pairs.A pair (i, j) is called good if nums[i] == nums[j] and i j.Example 1:Input: nums = [1,2,3,1,1,3]Output: 4Explanation: There are 4 good pairs (0,3), (0,4), (3,4), (2,5) 0-indexed.Example 2:Input: nums = [1,1,1,1]Output: 6Explanation: E.. 2024. 6. 15.
[LeetCode | Java | Array 문제 풀이] 1470. Shuffle the Array - Solution with Array & index 99 Club 2기 | Java | Beginner1470. Shuffle the Array🏷 관련 주제 : ArrayEasyGiven the array nums consisting of 2n elements in the form [x1,x2,...,xn,y1,y2,...,yn].Return the array in the form [x1,y1,x2,y2,...,xn,yn].Example 1:Input: nums = [2,5,1,3,4,7], n = 3Output: [2,3,5,4,1,7]Explanation: Since x1=2, x2=5, x3=1, y1=3, y2=4, y3=7 then the answer is [2,3,5,4,1,7].Example 2:Input: nums = [1,2,3,4,4,.. 2024. 6. 14.
[LeetCode | Java | Greedy 문제 풀이] 2037. Minimum Number of Moves to Seat Everyone - Solution with Arrays.sort() 99 Club 2기 | Java | Beginner🪑 2037. Minimum Number of Moves to Seat Everyone🏷 관련 주제 : Array Greedy SortingEasyThere are n seats and n students in a room. You are given an array seats of length n, where seats[i] is the position of the $i^{th}$ seat. You are also given the array students of length n, where students[j] is the position of the $j^{th}$ student.You may perform the following move any.. 2024. 6. 13.
728x90


Top