2017年3月31日

LeetCode: Pascal's Triangle II

摘要: Given an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1].Note: Could you optimize your algori... 阅读全文

posted @ 2017-03-31 12:00 gechen 阅读(71) 评论(0) 推荐(0) 编辑

2017年3月30日

LeetCode : Arranging Coins

摘要: You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.Given n, find the tota... 阅读全文

posted @ 2017-03-30 22:11 gechen 阅读(71) 评论(0) 推荐(0) 编辑

2017年3月29日

LeetCode : Binary Tree Paths

摘要: Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree:1 / \ 2 3 \ 5 All root-to-leaf path... 阅读全文

posted @ 2017-03-29 22:38 gechen 阅读(82) 评论(0) 推荐(0) 编辑

LeetCode : Number of Segments in a String

摘要: Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.Please note that the... 阅读全文

posted @ 2017-03-29 09:29 gechen 阅读(78) 评论(0) 推荐(0) 编辑

2017年3月28日

LeetCode : Pascal's Triangle

摘要: Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,... 阅读全文

posted @ 2017-03-28 23:34 gechen 阅读(67) 评论(0) 推荐(0) 编辑

LeetCode : Plus One

摘要: Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain an... 阅读全文

posted @ 2017-03-28 15:57 gechen 阅读(71) 评论(0) 推荐(0) 编辑

2017年3月27日

LeetCode : Valid Perfect Square

摘要: Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library... 阅读全文

posted @ 2017-03-27 22:38 gechen 阅读(81) 评论(0) 推荐(0) 编辑

LeetCode : Reverse Vowels of a String

摘要: Write a function that takes a string as input and reverse only the vowels of a string.Example 1: Given s = “hello”, return “holle”.Example 2:... 阅读全文

posted @ 2017-03-27 21:36 gechen 阅读(92) 评论(0) 推荐(0) 编辑

LeetCode : Power of Four

摘要: Given an integer (signed 32 bits), write a function to check whether it is a power of 4.Example: Given num = 16, return true. Given num = 5, ... 阅读全文

posted @ 2017-03-27 21:25 gechen 阅读(79) 评论(0) 推荐(0) 编辑

2017年3月25日

LeetCode : Repeated Substring Pattern

摘要: Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. ... 阅读全文

posted @ 2017-03-25 22:19 gechen 阅读(94) 评论(0) 推荐(0) 编辑

导航