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

2014年10月12日

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

2014年10月11日

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

2014年10月9日

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 阅读(267) 评论(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 阅读(198) 评论(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 阅读(296) 评论(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 阅读(209) 评论(0) 推荐(0)

2014年10月8日

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

2014年10月7日

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)

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

导航