✨ 문제 Find Targer Indices After Sorting ArrayYou are given a 0-indexed integer array nums and a target element target.A target index is an index i such that nums[i] == target.Return a list of the target indices of nums after sorting nums in non-decreasing order. If there are no target indices, return an empty list. The returned list must be sorted in increasing order. https://leetcode.com/problem..
알고리즘
✨ 문제 Neither Minimum nor MaximumGiven an integer array nums containing distinct positive integers, find and return any number from the array that is neither the minimum nor the maximum value in the array, or -1 if there is no such number. Return the selected integer. https://leetcode.com/problems/neither-minimum-nor-maximum/description/ ✨ 최종코드class Solution { public int findNonMinOrMax(int..
✨ 문제 Decode the MessageYou are given the strings key and message, which represent a cipher key and a secret message, respectively. The steps to decode message are as follows:Use the first appearance of all 26 lowercase English letters in key as the order of the substitution table.Align the substitution table with the regular English alphabet.Each letter in message is then substituted using the t..
✨ 문제 Shuffle StringYou are given a string s and an integer array indices of the same length.The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string. Return the shuffled string. https://leetcode.com/problems/shuffle-string/description/ ✨ 최종코드class Solution { public String restoreString(String s, int[] indices) { char[] answe..
✨ 문제 Counting Items Matching a RuleYou are given an array items, where each items[i] = [typei, colori, namei] describes the type, color, and name of the ith item. You are also given a rule represented by two strings, ruleKey and ruleValue.The ith item is said to match the rule if one of the following is true:ruleKey == "type" and ruleValue == typei.ruleKey == "color" and ruleValue == colori.rule..
✨ 문제 Find Words Containing CharacterYou 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. https://leetcode.com/problems/number-of-good-pairs/description/ ✨ 최종코드class Solution { public List findWordsContaining(String[] words, char x) { List indi..
✨ 문제 Shuffle the ArrayGiven 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. https://leetcode.com/problems/number-of-good-pairs/description/ ✨ 개념해시 테이블 Hash Table- 매우 효율적인 데이터 구조로, 키(Key)-값(Value) 쌍을 저장하고 검색하는데 사용됨.- 평균적으로 O(1)의 시간 복잡도로 데이터를 삽입, 삭제 및 검색할 수 있음. ✨ 최종코드class Solution { public int numIdenticalPairs(int[] num..
✨ 문제 Shuffle the ArrayGiven 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]. https://leetcode.com/problems/shuffle-the-array/description/ ✨ 최종코드class Solution { public int[] shuffle(int[] nums, int n) { int[] answerArr = new int[nums.length]; for (int i = 0; i 오늘의 문제는 정수형 배열 nums와 정수..
✨ 문제 Minimum Number of Moves to Seat EveryoneThere 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 ith seat. You are also given the array students of length n, where students[j] is the position of the jth student. https://leetcode.com/problems/minimum-number-of-moves-to-seat-everyone/description/?envType=daily-question&envId=2..
✨ 문제 Find Center of Star GraphThere is an undirected star graph consisting of n nodes labeled from 1 to n. A star graph is a graph where there is one center node and exactly n - 1 edges that connect the center node with every other node.You are given a 2D integer array edges where each edges[i] = [ui, vi] indicates that there is an edge between the nodes ui and vi. Return the center of the given..