マツシタのお勉強

2017-01-09から1日間の記事一覧

394. Decode String - Stackを使った解法 : Past Google Coding Interview

問題 leetcode.com s = "3[a]2[bc]", return "aaabcbc". s = "3[a2[c]]", return "accaccacc". s = "2[abc]3[cd]ef", return "abcabccdcdcdef". このように[]で囲まれた文字を直前の数字の数だけ繰り返しながら文字列を作って行く問題。 解法 これはStackを…

298. Binary Tree Longest Consecutive Sequence : Past Google Coding Interview

Problem https://leetcode.com/problems/binary-tree-longest-consecutive-sequence/ How to Solve This problem is classified into Tree and can be solve by using DFS(Depth First Search). Depth First Search Firstly, I thought the only search by D…

281. Zigzag Iterator : Past Google Coding Interview

Problem https://leetcode.com/problems/zigzag-iterator/ How to Solve By using Iterator and Queue, I can solve this problem. Iterator ListIterator (Java Platform SE 8 ) An iterator for lists that allows the programmer to traverse the list in…