【育児】購入リスト 鼻水吸引

鼻水を吸引する 子どもが産まれて、2週間経ったころに気になることがあった。 鼻が詰まって呼吸が苦しそうなのだ。 スヤスヤ寝ているようだが、時折いびきのような音を鼻?のど?から出すのである。 心配なので調べてみると、鼻水が出せずに溜まっているので…

【育児】購入リスト おくるみ

子どもが誕生した。 誕生前に揃えたり、育児中に必要になって揃えたものを紹介していく、 各々の家庭環境や生活環境、育児方針などで必要なもの不要なものが変わってくるだろうが、私の家ではこれを使っているよ。という話である。 おくるみ 新生児は子宮内…

【LeetCode】Easy: Longest Common Prefix

Longest Common Prefix https://leetcode.com/problems/longest-common-prefix/ 回答 class Solution { func longestCommonPrefix(_ strs: [String]) -> String { var min = strs.min()! while min.count > 0 { if strs.filter({ $0.contains(min) }).count …

【LeetCode】Easy: Roman to Integer

Roman to Integer https://leetcode.com/problems/roman-to-integer/ 自分の回答 class Solution { func romanToInt(_ s: String) -> Int { var output: Int = 0 var s: String = s while !s.isEmpty { let firstTwo = s.prefix(2) switch firstTwo { case "…

【LeetCode】Easy: Palindrome Number

Palindrome Number https://leetcode.com/problems/palindrome-number/ 自分の回答 class Solution { func isPalindrome(_ x: Int) -> Bool { var string = String(x) while string.count != 0 { if string.removeFirst() != string.popLast() { return fals…

【LeetCode】Easy: Reverse Integer

Reverse Integer https://leetcode.com/problems/reverse-integer/ 自分の回答 Swift Wrong Answer class Solution { func reverse(_ x: Int) -> Int { var xx: Int = x var array = [Int]() while xx != 0 { array.append(xx % 10) xx = xx / 10 } return …

【LeetCode】Easy: Two Sum

Two Sum https://leetcode.com/problems/two-sum/ 自分の回答 Swift Runtime: 12 ms class Solution { func twoSum(_ nums: [Int], _ target: Int) -> [Int] { let dic = Dictionary<Int, Int>(uniqueKeysWithValues: nums.enumerated().map{($0, $1)}) for (i, num) </int,>…