Kotlin147 [LeetCode][Kotlin] 14. Longest Common Prefix 14. Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "".문자열 배열 중에서 가장 긴 공통 접두사 문자열을 찾는 함수를 작성하세요. 공통 접두사가 없으면 빈 문자열 ""을 반환합니다. Example 1:Input: strs = ["flower","flow","flight"]Output: "fl"Example 2:Input: strs = ["dog","racecar","car"]Output: ""Explanation: There is no common prefix a.. 2024. 10. 18. [LeetCode][Kotlin] 80. Remove Duplicates from Sorted Array II 80. Remove Duplicates from Sorted Array IIGiven an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative order of the elements should be kept the same. Since it is impossible to change the length of the array in some languages, you must instead have the result be placed in the first part of the array n.. 2024. 10. 4. [LeetCode][Kotlin] 844. Backspace String Compare 844. Backspace String CompareGiven two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character. Note that after backspacing an empty text, the text will continue empty.두 개의 문자열 s와 t가 주어졌을 때, 둘 다 빈 텍스트 편집기에 입력했을 때 같으면 true를 반환합니다. '#'은 백스페이스 문자를 의미합니다. 빈 텍스트를 백스페이스한 후에는 텍스트가 계속 비어 있게 됩니다. Example 1:Input: s = "ab#c", t = "ad#c"Ou.. 2024. 10. 1. [LeetCode][Kotlin] 680. Valid Palindrome II 680. Valid Palindrome IIGiven a string s, return true if the s can be palindrome after deleting at most one character from it.문자열 s가 주어지면, 최대 한 문자를 삭제한 후 s가 회문일 수 있으면 true를 반환합니다. Example 1:Input: s = "aba"Output: true Example 2:Input: s = "abca"Output: trueExplanation: You could delete the character 'c'. Example 3:Input: s = "abc"Output: false Constraints:1 s consists of lowercase English lette.. 2024. 9. 30. [LeetCode][Kotlin] 799. Champagne Tower 799. Champagne TowerWe stack glasses in a pyramid, where the first row has 1 glass, the second row has 2 glasses, and so on until the 100th row. Each glass holds one cup of champagne. Then, some champagne is poured into the first glass at the top. When the topmost glass is full, any excess liquid poured will fall equally to the glass immediately to the left and right of it. When those glasses.. 2024. 9. 25. [LeetCode][Kotlin] 2610. Convert an Array Into a 2D Array With Conditions 2610. Convert an Array Into a 2D Array With ConditionsYou are given an integer array nums. You need to create a 2D array from nums satisfying the following conditions:The 2D array should contain only the elements of the array nums.Each row in the 2D array contains distinct integers.The number of rows in the 2D array should be minimal.Return the resulting array. If there are multiple answers, ret.. 2024. 9. 25. [LeetCode][Kotlin] 68. Text Justification 68. Text JustificationGiven an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified. You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces ' ' when necessary so that each line has exactly maxWidth characters. Extra spaces between wor.. 2024. 9. 23. 이전 1 ··· 4 5 6 7 8 9 10 ··· 21 다음