[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.
⇧
Top