google面试题目
文章平均质量分 66
overstack
中大研究生喜欢linux后台技术各种架构研究方向是机器学习和数据挖掘
展开
-
google面试题目3
Given an array and an integer k , find the maximum for each and every contiguous sub array of size k.Sample Input :1 2 3 1 4 5 2 3 63 [ value of w ] Sample Output : 3 3 4 5 5 5 6分析:A原创 2012-12-26 15:29:03 · 466 阅读 · 0 评论 -
(google面试题)找出无序数组中连接和最大排序
Problem:Given an integer array, sort the integer array such that the concatenated integer of the result array is max.Example: [4, 94, 9, 14, 1] will be sorted to [9,94,4,14,1] where the result integer原创 2012-12-24 01:50:03 · 544 阅读 · 0 评论 -
google面试题目
给定两个按升序排好序的正整数数组A(n)和B(n)。找出n个最小和(a+b)对(a,b),其中a属于A,b属于B。例如A=[1,5],B=[2,3],那么2个最小和对是(1,2)和(1,3)。如果A=[1,2],B=[2,4],那么答案是(1,2)和(2,2)。解答:1、维护一个小根堆,初始化只有一个元素,为最小的两个数的和;2、取堆顶元素,假设为该元素为(A[i]+B[j]),同时将(A[i原创 2013-02-23 19:52:02 · 563 阅读 · 0 评论 -
google面试题8
You are given an array that contains integers. The integers content is such that every integer occurs 3 times in that array leaving one integer that appears only once.Fastest way to find that single原创 2013-01-05 14:28:31 · 370 阅读 · 0 评论 -
google面试题目4
Given an array having positive integers, find a continous subarray which adds to a given number.It can be done O(n). My logic is as follows:- Keep adding elements to a running sum till it is e原创 2012-12-26 20:53:29 · 430 阅读 · 0 评论 -
#google面试题14#找出两个排序数组的合并后的中位数
given sorted int[] A, int[] B. How would you find the maiden that would have been if both were combined to one big sorted array? Use divide and conqure recurssion. please write method "GetMutualMa转载 2013-03-07 22:06:54 · 764 阅读 · 0 评论 -
#google面试题目13#输出对应字符的操作序列
Given the English alphabet, 'a' through 'z' (lowercase), and an imaginary onscreen keyboard with the letters laid out in 6 rows and 5 columns:a b c d ef g h i jk l m n op q r s tu v w x原创 2013-03-07 20:56:19 · 666 阅读 · 0 评论 -
google面试题目10
/*Given an inorder traversal only for a binary tree (not necessarily aBST), give a pseudo code to generate all possible binary trees forthis traversal sequence.Firstly, how many binary trees can原创 2013-01-12 22:20:39 · 582 阅读 · 0 评论 -
google面试题目11
/* * ===================================================================================== * * Filename: g14.cpp * * Description: * * Version: 1.0 * Created: 2013年0原创 2013-01-13 17:19:54 · 447 阅读 · 0 评论 -
google面试题9
->it is asked by my friend.in China, number "4" is not good because it is has the same pronunciation as "death" in Chinese. so there is a new number system which we may make 4 disappear in the cur原创 2013-01-06 01:40:49 · 444 阅读 · 0 评论 -
google面试题目7
Write a program to determine whether n/2 distintinctive pairs can be formed from given n integers where n is even and each pair's sum is divisible by given k. Numbers cannot be repeated in the pairs原创 2013-01-03 21:39:35 · 498 阅读 · 0 评论 -
google面试题6
Imagine you have a special keyboard with the following keys:ACtrl+ACtrl+CCtrl+Vwhere CTRL+A, CTRL+C, CTRL+V each acts as one function key for “Select All”, “Copy”, and “Paste” operat原创 2012-12-31 12:14:14 · 500 阅读 · 0 评论 -
google面试题5-Balanced Partition
You have a set of n integers each in the range 0 ... K. Partition these integers into two subsets such that you minimize |S1 - S2|, where S1 and S2 denote the sums of the elements in each of the two s原创 2012-12-31 09:49:24 · 1568 阅读 · 0 评论 -
O(n)时间找出无序数组中最长的连续递增序列
You are given an Array of numbers and they are unsorted/random order. You are supposed to find the longest sequence of consecutive numbers in the array. Note the sequence need not be in sorted ord原创 2012-12-23 13:48:07 · 973 阅读 · 0 评论