上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 33 下一页
摘要: 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) 编辑
摘要: Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 题解:送分题。。。 阅读全文
posted @ 2016-04-23 02:04 周洋 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 就是一个二分法快速幂。 但是需要注意的问题是这里是实数,而且n可能为负。int的范围是-2,147,483,648 至 2,147,483,647。如果为-2,147,483,648那么直接n=-n就爆int了。所以先要把n换成longlong。 阅读全文
posted @ 2016-04-21 14:37 周洋 阅读(274) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro 阅读全文
posted @ 2016-04-21 02:03 周洋 阅读(3456) 评论(0) 推荐(0) 编辑
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 33 下一页