2018-01-01から1年間の記事一覧

TypeScriptでHubotを書いてみた

TypeScript Advent Calendar 2018 11日目の記事です。 ChatOpsの導入として、何かしらのbotをNode.jsで書いてみたいなあと思いまして、 社内向けにHubot(もう古い?)を導入してみました。 Node.jsでの開発は初めてだったのですが、せっかくならTypeScript…

LeetCode: ZigZag Conversion

Easy問題ばかり解いていたので、たまにはMedium問題を解きます。 問題 The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) …

LeetCode: Valid Parentheses

問題 Given a string 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 close…

LeetCode: Longest Common Prefix

問題 Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". 解答 大して上手いやり方が思い当たらず、力任せに解くことにしました。 class Solution { publi…

HerokuにTypeScriptのアプリをデプロイしたら見事にハマった話

Heroku Advent Calendar 2018 5日目の記事です。 今日は題名の通り、HerokuにTypeScriptのアプリをデプロイしたら見事にハマった話をします。 ただ外部サービスやアドオン、DBなどの話は 出てきません 。 普通に設定をミスして*.tsがコンパイルされなかった…

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…