- 博客(33)
- 资源 (9)
- 收藏
- 关注
原创 [cc]18.9中位数
Numbers are randomly generated and passed to a method. Write a program to find and maintain the median value as new values are generated.随机产生一些数传递给一个函数,写程序找出并维护这些数的中位数。maxheap and minheap的应用
2015-04-22 01:24:46
468
原创 Coding Question
面过的几家小公司,结果有好有坏,但是感觉自己基础还是很差,要学习的东西真是还有很多,总结一下做的不好的题目1 liveramp分析时间复杂度题目: n 个数,任意两个组成pair, 问所有pair再相加时间复杂度,题目明显引导你选O(n^2),但是其实O(n)就解决!2 6 degree 问题,求任意两个actors之间的degree之前看面经的时候有人说bfs就没多想,但
2015-04-16 11:06:12
423
原创 Remove duplicate 问题
leetcode上有四道题,主要是remove from linked list和array都是two pointer解决,要注意终止条件,还有移动指针时条件
2015-04-08 05:44:29
980
原创 17.9设计一个函数,找到给定单词在一本书中的出现次数
cc 17.9 hashtable应用首先需要考虑这个函数被调用的次数,如果只查询一次,直接遍历整本书,计算给定单词次数。时间只能是O(N)。正常情况下通常需要可以多次调用这样pre-processing the book,use hashtable to store word, frequency. then we can easily look up by O(1) tim
2015-04-08 01:15:02
871
原创 [cc]17.10 print encoded version of an XML element
Question: 17.10 按照新的要求encode xmlgiven a way of encoding XML where each tag gets mapped to a pre-defined integer value. language/grammar is as follows:Element --> Tag Attributes END Children EN
2015-04-07 05:32:47
445
原创 Top K frequency 系列
似乎这类问题还是满经常被遇到的,一直不是特别会,决定把这类问题做一个总结,如果遇到新的时时更新加进来idea: 通常hashmap 来记录 统计频率然后minheap(priorityqueue), 这里用minheap而通常不用maxheap,因为frenquency 最小的会在上面,比较和替换比较方便,如果next比当前top k中最小的大,则replace with top and
2015-04-06 14:20:35
486
原创 LinkedList
LinkedList easy to expend, such as insert or deleteeach element is a separate object : Nodedisadvantage: need more memory to store reference to next node( extra 4 bytes on 32-bit CPU)Two type:
2015-04-06 01:56:28
348
原创 [cc一百五]Unique char in String
Q1.1 Whether a string has all unique characters, if not use additional data structure
2015-04-01 00:14:32
509
原创 [phone]找连续字符组成的substring的组成char
其实是个很easy的问题,但是当时的code就是写的很垃圾,提示再三才写了这么一个code,应该还有可以improve的空间。典型的双指针问题,一前一后找substring,这里要考虑如何节省空间,尽可能的少存解。要求 one loop例如 abcdefg....xyzz input"thiisiissoodd", returns i i s o d input2 "thiiiss
2015-03-10 06:22:24
396
原创 Find next node in bst
碰到过好几次,interview常考高频题,面宝石家的时候这道题当时跪的很彻底,在小哥各种题目下才勉强写出来。其实大意就是找inorder traversal 里下一个,但是不需要得到所有inorder 结果geeksforgeek(1)有parent指针在cc150上有很好的讲解三种情况:i 当前node的right != null, 则返回leftmost of
2015-03-08 08:15:13
584
原创 Path Sum
最开始觉得很简单dfs的题,但是再做的时候才发现第一次做的时候很多问题并没有想清楚想明白结合面经把这道题重新做一遍。1 Path Sum from root to leafleetcode原题 pathsumiiGiven a binary tree and a sum, find all root-to-leaf paths where each path's sum equ
2015-03-08 06:50:05
348
原创 Find All local extrema
一个公司(名字就不提了)OA的题,做的时候觉得很简单,测试也过了,但后来还是挂了,当时没仔细想,后来看到有人po这道题,所以回来重新写一下,发现自己当时确实想错了。题目大意如下,就是找所有peak的总数,但是和leetcode那道peak的题目不同 1 有duplicate 2 需要找所有的peak之前总想着binary search,但是在这种情况下只能two pointer
2015-03-07 02:46:59
695
翻译 Probability of passing exam by guessing
Q37: Probability of passing exam by guessing10 multiple choice (abcd 4 choices) questions , pass = at least 5/10 questions are guessed correctly, how possible is that you can pass the exam just by g
2015-02-10 05:14:13
537
翻译 CC150 OOD Parking Lot
Design a parking lot using object- oriented principleshttps://github.com/gaylemcd/ctci/tree/master/java/Chapter%208/Question8_4首先: 需要和面试官讨论把问题具体化, 例如 可停的汽车类型, 是否是多层的parking lot 等等。然后做出如下假设(1
2015-02-04 12:01:24
10080
翻译 CC150 OOD question BlackJack
version 5 chapter 8 question 1https://github.com/gaylemcd/ctci/tree/master/java/Chapter%208/Question8_1题目是设计纸牌的数据结构,并且实现blackjack游戏首先确认设计为标准可拓展的cardsstandard 52 card set, It includes thi
2015-02-04 02:39:31
3781
原创 Flood fill Algorithm – how to implement fill() in paint?
http://www.geeksforgeeks.org/flood-fill-algorithm-implement-fill-paint/画板fill功能的实现,看描述第一反应是bfs遍历即可,但是这个算法似乎更多用dfs来实现dfs实现:根据gfg上的codepublic static void floodFill(int[][] screen , int x, int
2015-01-18 13:06:29
810
原创 Lexicographically minimum string rotation
http://geeksquiz.com/lexicographically-minimum-string-rotation/lexicographically字典序,在文本分析和搜索中有不少应用,比如在查询语句的预处理时,可以通过求得 lexicographic minimum,类似的查询就可以命中缓存,只在排序的时候考虑一下关键词在文档里的距离。gfg上给了一种最基础的做法,就
2015-01-17 13:44:48
1802
原创 中序表达式求值
Geeksforgeek上题目 http://geeksquiz.com/program-evaluate-simple-expressions/You are given a string that represent an expression of digits and operands. E.g. 1+2*3, 1-2+4. You need to evaluate the s
2015-01-17 06:26:04
1166
原创 Find common elements in three sorted arrays
Geeksforgeeeks上的一道题,原文http://www.geeksforgeeks.org/find-common-elements-three-sorted-arrays/iven three arrays sorted in non-decreasing order, print all common elements in these arrays.Exampl
2015-01-16 01:47:01
518
原创 A data structure for n elements and O(1) operations
GFG上的一道数据结构的题:http://geeksquiz.com/data-structure-n-elements-o1-operations/设计一个数据结构插入删除和查找都是O(1),存储 0 - n-1最初想法是hashtable类似,基于链表,但是查找不可能为O(1), 看了gfg上的讲解才豁然开朗。Solution:就是用一个数组实现,因为要存的数已
2015-01-15 14:17:00
402
原创 Design Pattern--Singleton
Design Pattern参考 ooDesignSingletonSingletons used for centralized management of internal or external resources(1 ) Only one instance of a class is created: it involves only one class which
2015-01-14 11:38:18
621
原创 Reverse String Question
Reverse String Question1 Reverse the string word by word (from leetcode)For example,Given s = "the sky is blue",return "blue is sky the".Clarification:What constitutes a word? A sequence
2015-01-14 08:17:41
402
原创 Implement Stack Using Queue
We are given a Queue data structure that supports standard operations like enqueue() and dequeue(). We need to implement a Stack data structure using only instances of Queuethis question is from Gee
2015-01-14 03:25:45
636
原创 hashtable HashMap相关问题
Rehash Question & hashfucntionhashtable相关问题,主要帮助理解hashtable
2015-01-14 01:05:25
575
原创 Factorial Trailing Zeros
leetcode questionGiven an integer n, return the number of trailing zeroes in n!.Your solution should be in logarithmic time complexity.need to pay attention basic situation is N <= 0, no zero!
2015-01-13 08:14:26
1519
原创 Partition Array/ Sort Color
Partition array 和leetcode中sort color的想法类似: 用two pointer, 一个start (= k),遇到不满足的就交换Partition Arrayquestion from lintcode
2015-01-11 02:35:18
506
图像匹配 sift算法
2012-04-25
关于SQL2000 安装遇到挂起问题的解决方法
2010-08-25
ERIS 大赛 arcgis 软件安装指导
2010-07-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人