목록전체 글 (130)
고양이와 코딩
연결리스트 문제는,, 첨 풀어봐서 ~ 검색해보고 아이디어를 얻어서 힘겹게 ㄱ ㅡ풀어냈다(이게 easy라니 이게easy라니 이게easy라니 죽자) You are given the heads of two sorted linked lists list1 and list2.Merge the two lists into one sorted list. The list should be made by splicing together the nodes of the first two lists.Return the head of the merged linked listInput: list1 = [1,2,4], list2 = [1,3,4]Output: [1,1,2,3,4,4]Example 2:Input: list1 = [], ..
프로그래머스에서 풀었었던 괄호문제! Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of brackets.Open brackets must be closed in the correct order.Every close bracket has a corresponding open bracket of the same type. Example 1:Input: s = "()"Output: trueExample 2:Inpu..
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 among the input strings. Constraints:1 0 strs[i] consists of only lower..
머리가..굳어..머리가..굳어..머리가...... 13. Roman to Integer Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D 500M 1000For example, 2 is written as II in Roman numeral, just two ones added together. 12 is written as XII, which is simply X + II. The numbe..
9. Palindrome Number Given an integer x, return true if x is a palindrome, and false otherwise. Example 1:Input: x = 121Output: trueExplanation: 121 reads as 121 from left to right and from right to left.Example 2:Input: x = -121Output: falseExplanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.Example 3:Input: x = 10Output: falseEx..
1. Two Sum Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.You may assume that each input would have exactly one solution, and you may not use the same element twice.You can return the answer in any order. Example 1:Input: nums = [2,7,11,15], target = 9Output: [0,1]Explanation: Because nums[0] + nums[1] == 9, we return [0,..