leetcode
u010912405
这个作者很懒,什么都没留下…
展开
-
Simple Number II
Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without usi原创 2014-11-01 22:11:09 · 373 阅读 · 0 评论 -
Reverse Words in a String
class Solution {public: void reverseWords(string &s) { string ss; int i = s.length()-1; while(i>=0) { while(i>=0&&s[i] == ' ') {原创 2014-11-01 19:10:59 · 351 阅读 · 0 评论 -
Maximum Product Subarray
public class Solution { public int maxProduct(int[] A) { int n=A.length; if(n==0) return 0; if(n==1) return A[0]; int curMin=A[0]; int curMax=A[0];原创 2014-11-01 19:19:37 · 377 阅读 · 0 评论 -
leetcode Word Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"原创 2014-11-01 20:27:21 · 384 阅读 · 0 评论