2018-11-01から1ヶ月間の記事一覧

LeetCode: Reverse Integer

問題 Given a 32-bit signed integer, reverse digits of an integer. 解答 どうしようか迷ったのですが、入力値をStringにして反転して出力するのが一番楽そうだなと思ってそれで実装することにしました。 反転した値がオーバーフローする場合は0を返す仕様…

LeetCode: Add Two Numbers

問題 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume…

LeetCode: Two Sum

はじめに LeetCodeを始めてみた。 その1問目がこれ。 問題 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may no…