Technology Blog

the technology I am interested in and work with

Tuesday, April 19, 2011

Count the number of occurrences of a given key in an array

›
This was asked in on-site Microsoft interview (see original post ).  It seems the answers to this question are not correct.  This question c...
Monday, April 18, 2011

Find the first occurrence of an integer in sorted array

›
Normal binary search will return the target randomly if multiple targets are in the given array.  Below is the modified version of binary se...
Wednesday, April 13, 2011

Implementation of the procedure RANDOM(a, b) that only makes calls to RANDOM(0, 1).

›
Implementation of the procedure RANDOM(a, b) that only makes calls to RANDOM(0, 1).  This is the question asked in book "Introduction t...
Tuesday, April 12, 2011

Maximum subarray

›
This is an interview question: Given an integer array, find the max sum in any contiguous sub-array.  If all elements are negative, then t...
Tuesday, January 11, 2011

print a column using awk and remove dups

›
The following command will print the 3rd column in file input.txt: awk '{print $3}' input.txt Using redirect to output the re...
Friday, January 7, 2011

Select a range from oracle, mysql

›
I talked about how to select first/top n rows from oracle, mysql, and ms sql server. How do we get the range, say from m to n , where m O...
Tuesday, December 28, 2010

Select first n rows from oracle, MySql and MS Sql

›
Assume we have table customer with columns id and age . Find first n customers with youngest ages Oracle select * from (select * from cus...
‹
›
Home
View web version
Powered by Blogger.