본문 바로가기

leetcode73

[LeetCode][Kotlin] 49. Group Anagrams 49. Group AnagramsGiven an array of strings strs, group the anagrams together. You can return the answer in any order.문자열 strs 배열이 주어지면, 애너그램을 그룹화합니다. 어떤 순서로든 답을 반환할 수 있습니다. Example 1:Input: strs = ["eat","tea","tan","ate","nat","bat"]Output: [["bat"],["nat","tan"],["ate","eat","tea"]]Explanation:There is no string in strs that can be rearranged to form "bat".The strings "nat" and "tan" are anag.. 2024. 8. 13.
[LeetCode][Kotlin] 242. Valid Anagram 242. Valid AnagramGiven two strings s and t, return true if t is an anagram of s, and false otherwise.두 개의 문자열 s와 t가 주어졌을 때, t가 s의 애너그램이면 true를 반환하고, 그렇지 않으면 false를 반환합니다. Example 1:Input: s = "anagram", t = "nagaram"Output: true Example 2:Input: s = "rat", t = "car"Output: false Constraints:1 s and t consist of lowercase English letters.코드 1아나그램은 두 단어나 구문이 문자와 문자 개수가 같고, 순서가 다른 경우를 의미한다.즉, 정렬한 .. 2024. 8. 12.
[LeetCode][Kotlin] 217. Contains Duplicate 217. Contains DuplicateGiven an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.정수 배열 nums가 주어졌을 때, 배열에 값이 두 번 이상 나타나면 true를 반환하고, 모든 요소가 다르면 false를 반환합니다. Example 1:Input: nums = [1,2,3,1]Output: trueExplanation:The element 1 occurs at the indices 0 and 3. Example 2:Input: nums = [1,2,3,4]Output: falseExplanation:Al.. 2024. 8. 12.