10 2014 档案

项目描述
摘要:1. image filter : 项目描述: Image filtering allows you to apply various effects on photos. after open the app, customer can pick a image from Sd card ori... 阅读全文

posted @ 2014-10-31 03:47 brave_bo 阅读(300) 评论(0) 推荐(0)

无论所有题,一定要先分析清楚,所有eade case和逻辑都满足后,再动笔
摘要:无论所有题,一定要先分析清楚,所有eade case和逻辑都满足后,再动笔 阅读全文

posted @ 2014-10-30 03:46 brave_bo 阅读(134) 评论(0) 推荐(0)

heap
摘要:http://www.youtube.com/watch?v=-6-xKgLOZPMbinary heap : it is a complete binary tree.index from 0:i left = 2i +1; i right = 2i +2, i parent = (i-1)/2.... 阅读全文

posted @ 2014-10-29 03:41 brave_bo 阅读(273) 评论(0) 推荐(0)

select sort
摘要:http://www.youtube.com/watch?v=EdUWyka7kpI 阅读全文

posted @ 2014-10-28 08:14 brave_bo 阅读(132) 评论(0) 推荐(0)

quick sort and find the k largest number in array.
摘要:1. using priortyqueue. priortyqueue是没有固定size的. http://wlh0706-163-com.iteye.com/blog/1850125 源码PriorityQueue(int initialCapacity, Comparator comparat... 阅读全文

posted @ 2014-10-28 08:11 brave_bo 阅读(165) 评论(0) 推荐(0)

counting sort ( can sort 0-k Auxiliary Space: O(n+k) Time Complexity: O(n+k) )
摘要:http://www.youtube.com/watch?v=o3FUC6l89tMhttp://www.geeksforgeeks.org/counting-sort/only 0 - k can not be negtive71522 最大7.new array(7).0 1 2 3 4 5... 阅读全文

posted @ 2014-10-24 06:25 brave_bo 阅读(164) 评论(0) 推荐(0)

weather station observer
摘要:public interface Subject {public void registerObserver(Observer o);public void removeObserver(Observer o);public void notifyObservers();}public interf... 阅读全文

posted @ 2014-10-24 03:11 brave_bo 阅读(216) 评论(0) 推荐(0)

facebook -- Typeahead Search
摘要:https://www.facebook.com/video/video.php?v=432864835468首先先看演讲. 太有营养了.1, trie .is straight forward, butwaste space, thrashes cache.1.points are huge.2.... 阅读全文

posted @ 2014-10-18 06:02 brave_bo 阅读(336) 评论(0) 推荐(0)

sort algorithm
摘要:insert sort:merge sort:其实很像后续遍历.package com.java2novice.sorting; public class MyMergeSort { private int[] array; private int[] tempMergArr;... 阅读全文

posted @ 2014-10-17 04:27 brave_bo 阅读(182) 评论(0) 推荐(0)

find the deepest node in a binary tree
摘要:Find the deepest node in a binary tree:Example:A/ \B C/ \ / \D E F G\HReturn Node ‘H’public class test { //unsigned 2^32-1 so we need a long to ins... 阅读全文

posted @ 2014-10-15 02:49 brave_bo 阅读(163) 评论(0) 推荐(0)

Lowest Common Ancestor of a Binary Tree Part
摘要:bottom-uppackage test.ui;import java.util.HashSet;import java.util.Set;public class test { //unsigned 2^32-1 so we need a long to instead. pub... 阅读全文

posted @ 2014-10-12 05:51 brave_bo 阅读(167) 评论(0) 推荐(0)

Balanced Binary Tree
摘要:/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; ... 阅读全文

posted @ 2014-10-12 05:33 brave_bo 阅读(204) 评论(0) 推荐(0)

Lowest Common Ancestor of a Binary Tree Part I
摘要:456789101112131415161718192021// Return #nodes that matches P or Q in the subtree.int countMatchesPQ(Node *root, Node *p, Node *q) { if (!root) retur... 阅读全文

posted @ 2014-10-12 05:18 brave_bo 阅读(177) 评论(0) 推荐(0)

Splitting Linked List
摘要:This is a very good linked list question, as there are tricky cases you have to consider, and getting them all right in one place is harder than it lo... 阅读全文

posted @ 2014-10-12 04:17 brave_bo 阅读(202) 评论(0) 推荐(0)

Number of 1 bits
摘要:Brute force solution:Iterate 32 times, each time determining if the ith bit is a ’1′ or not. This is probably the easiest solution, and the interviewe... 阅读全文

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

behavior quesition
该文被密码保护。

posted @ 2014-10-11 04:44 brave_bo 阅读(10) 评论(0) 推荐(0)

Printing a Binary Tree in Level Orders
摘要:BFS:Is it possible that a solution exists using only one single queue? Yes, you bet. The single queue solution requires two extra counting variables w... 阅读全文

posted @ 2014-10-11 02:52 brave_bo 阅读(149) 评论(0) 推荐(0)

Searching an Element in a Rotated Sorted Array
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). How do you find an elemen... 阅读全文

posted @ 2014-10-09 06:25 brave_bo 阅读(273) 评论(0) 推荐(0)

Rotating an array in place
摘要:April 13, 2010inUncategorizedRotate a one-dimensional array of n elements to the right by k steps.For instance, with n=7 and k=3, the array {a, b, c, ... 阅读全文

posted @ 2014-10-09 05:53 brave_bo 阅读(200) 评论(0) 推荐(0)

Print matrix spiral
摘要:ProblemPrint a matrix in spiral fashion.SolutionWe will first print the periphery of the matrix by the help of 4 for loops. Then recursively call this... 阅读全文

posted @ 2014-10-09 05:00 brave_bo 阅读(302) 评论(0) 推荐(0)

Finding intersection of two sorted arrays
摘要:Find the intersection of two sorted arrays.Let’s called array1 as A and array2 as B, each with size m and n.The obvious brute-force solution is to sca... 阅读全文

posted @ 2014-10-09 03:12 brave_bo 阅读(210) 评论(0) 推荐(0)

Get average stock price every 10 minutes
摘要:Write a class that displays average of stock prices for a given stock symbol for the last 10 minutes. We have a service that sends stock updates about... 阅读全文

posted @ 2014-10-08 08:18 brave_bo 阅读(275) 评论(0) 推荐(0)

matrix travers
摘要:Write a code to read and write a matrix in below given way.Note : no. indicates the sequence here.I/P1 2 34 5 67 8 9O/P 11 4 72 5 83 6 9for(i=0;i<row;... 阅读全文

posted @ 2014-10-08 06:16 brave_bo 阅读(120) 评论(0) 推荐(0)

Rand1 -> RandN
摘要:Rand1*1 => uinformly distribution of 0,1 2Rand1*2 + Rand1 => 0,1,2,3 4Rand1*3 + Rand2 => 0,1,2,3,4,5 6Rand1*4 + Rand3 => 0,1,... 阅读全文

posted @ 2014-10-07 06:12 brave_bo 阅读(393) 评论(0) 推荐(0)

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 阅读(356) 评论(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)

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 阅读(193) 评论(0) 推荐(0)

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 阅读(194) 评论(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)

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 阅读(156) 评论(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 阅读(106) 评论(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)

Tree 总结
摘要:http://leetcode.com/2011/07/lowest-common-ancestor-of-a-binary-tree-part-i.html两种思路:top-down bottom-up递归实现,递归里面可以添加小递归方法. n^2自己总结的万能思路首先1. top-down 还... 阅读全文

posted @ 2014-10-01 05:54 brave_bo 阅读(126) 评论(0) 推荐(0)

导航