Fork me on GitHub
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 37 下一页
摘要: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at 阅读全文
posted @ 2017-05-12 21:10 hellowOOOrld 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twi 阅读全文
posted @ 2017-05-12 20:23 hellowOOOrld 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2017-05-12 16:17 hellowOOOrld 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two di 阅读全文
posted @ 2017-05-12 11:09 hellowOOOrld 阅读(172) 评论(0) 推荐(0) 编辑
摘要: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
posted @ 2017-05-11 23:01 hellowOOOrld 阅读(148) 评论(0) 推荐(0) 编辑
摘要: You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/ve 阅读全文
posted @ 2017-05-11 21:32 hellowOOOrld 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the numbe 阅读全文
posted @ 2017-05-11 19:06 hellowOOOrld 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 最近需要用到整型转字符串的操作,学习了stringstream一些皮毛。 首先需要包含头文件。 然后用流操作的方式将值传递给stringstream对象ss。而ss.str()即为转换的字符串。 还有需要注意的是,重置stringstream的时候,首先天然想到clear()方法,但是试验之后发现效 阅读全文
posted @ 2017-05-11 18:30 hellowOOOrld 阅读(1184) 评论(0) 推荐(0) 编辑
摘要: Write a function to find the longest common prefix string amongst an array of strings. 思路: 首先得到最短的字符串长度length,然后从0开始到length长度 挨个比较每一个字符是否相等。 阅读全文
posted @ 2017-05-11 16:12 hellowOOOrld 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Implement int sqrt(int x). Compute and return the square root of x. 思路: 二分法。牛顿迭代法。 参考: https://discuss.leetcode.com/topic/8689/newton-s-iterative-meth 阅读全文
posted @ 2017-05-11 15:34 hellowOOOrld 阅读(157) 评论(0) 推荐(0) 编辑
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 37 下一页