摘要: 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:Given s 阅读全文
posted @ 2016-04-25 11:09 周洋 阅读(142) 评论(0) 推荐(0) 编辑
摘要: Description: Count the number of prime numbers less than a non-negative number, n. 题解:就是线性筛素数的模板题。 阅读全文
posted @ 2016-04-25 04:16 周洋 阅读(258) 评论(0) 推荐(0) 编辑
摘要: Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. For example, given the range [5, 阅读全文
posted @ 2016-04-25 03:33 周洋 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 -- 阅读全文
posted @ 2016-04-25 03:15 周洋 阅读(626) 评论(0) 推荐(0) 编辑
摘要: 题意:把一个链表倒过来。 题解:有递归和非递归两种方式,主要就是考察指针操作的熟悉程度。 递归的方法: 非递归:就一个一个转过来方向就好了。转的时候需要用两个辅助指针,一个指向该节点的前一个节点,一个指向后一个节点。 阅读全文
posted @ 2016-04-25 02:31 周洋 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrenc 阅读全文
posted @ 2016-04-25 01:50 周洋 阅读(247) 评论(0) 推荐(0) 编辑
摘要: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen 阅读全文
posted @ 2016-04-25 01:36 周洋 阅读(312) 评论(0) 推荐(0) 编辑
摘要: Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege 阅读全文
posted @ 2016-04-25 01:35 周洋 阅读(216) 评论(0) 推荐(0) 编辑