上一页 1 2 3 4 5 6 7 8 ··· 16 下一页

2014年10月7日

rand(5) -> rand(7)

摘要: int rand7() //random number from 1 - 7{ int r = 0; do { int a = rand(5) - 1; //uniformly at random from 0 to 4 int b = rand(5) - ... 阅读全文

posted @ 2014-10-07 05:40 brave_bo 阅读(354) 评论(0) 推荐(0)

神小逻辑 Remove Duplicates from Sorted Array

摘要: /*put all vaild new array from the 0 to new length*/public class Solution { public int removeDuplicates(int[] A) { if(A.length < 2) ... 阅读全文

posted @ 2014-10-07 04:19 brave_bo 阅读(111) 评论(0) 推荐(0)

基础 sorted array查找最多的一个值.

摘要: int pp = 1; //number of points in the same line of the point i if (k.size()==0){pp=0;} for (int jj=1;jjres){res=pp... 阅读全文

posted @ 2014-10-07 03:07 brave_bo 阅读(171) 评论(0) 推荐(0)

Max Points on a Line

摘要: 计算所有的slope 放到一个arraylist中. 特殊情况是the same as point . 遍历所有./** * Definition for a point. * struct Point { * int x; * int y; * Point() : x(0)... 阅读全文

posted @ 2014-10-07 03:05 brave_bo 阅读(149) 评论(0) 推荐(0)

2014年10月4日

Regular Expression Matching

摘要: ‘.’ Matches any single character.‘*’ Matches zero or more of the preceding element.The matching should cover theentireinput string (not partial).The f... 阅读全文

posted @ 2014-10-04 03:23 brave_bo 阅读(190) 评论(0) 推荐(0)

2014年10月3日

strstr

摘要: N(n*m)的时间复杂度public class Solution {public String strStr(String haystack, String needle) { int nLen = needle.length(); int hLen = haystack.lengt... 阅读全文

posted @ 2014-10-03 16:20 brave_bo 阅读(191) 评论(0) 推荐(0)

valid bank money number

摘要: 一直对这种题比较没把握. 没有思路.i1,000,000.2234,333.999define valid(String s,boolean last,boolean first)1.先s.trim();if string==null or string.length==0 return false... 阅读全文

posted @ 2014-10-03 07:34 brave_bo 阅读(204) 评论(0) 推荐(0)

2014年10月2日

Symmetric Tree

摘要: Symmetric TreeGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric... 阅读全文

posted @ 2014-10-02 03:20 brave_bo 阅读(153) 评论(0) 推荐(1)

Sum Root to Leaf Numbers

摘要: Sum Root to Leaf NumbersGiven a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-l... 阅读全文

posted @ 2014-10-02 03:13 brave_bo 阅读(102) 评论(0) 推荐(0)

Longest Substring Without Repeating Charactersdf

摘要: 首先呢 可能会想到用一个windows去放这些东西.可能会想到hashtable去. 但是hashtable 无法用Index去查询.abcabcbb. hashtable: abc 当第二个a来的时候, 我们想bca 貌似不好实现.这种情况就很像LRU. 用 node连接,用hashta... 阅读全文

posted @ 2014-10-02 02:56 brave_bo 阅读(128) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 ··· 16 下一页

导航