![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
面经准备
文章平均质量分 53
xiaomaolearnCoding
这个作者很懒,什么都没留下…
展开
-
Reverse String Question
Reverse String Question 1 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 · 370 阅读 · 0 评论 -
Find All local extrema
一个公司(名字就不提了)OA的题,做的时候觉得很简单,测试也过了,但后来还是挂了,当时没仔细想,后来看到有人po这道题,所以回来重新写一下,发现自己当时确实想错了。 题目大意如下,就是找所有peak的总数,但是和leetcode那道peak的题目不同 1 有duplicate 2 需要找所有的peak 之前总想着binary search,但是在这种情况下只能two pointer原创 2015-03-07 02:46:59 · 653 阅读 · 0 评论 -
Path Sum
最开始觉得很简单dfs的题,但是再做的时候才发现第一次做的时候很多问题并没有想清楚想明白结合面经把这道题重新做一遍。 1 Path Sum from root to leaf leetcode原题 pathsumii Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equ原创 2015-03-08 06:50:05 · 319 阅读 · 0 评论 -
[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 · 436 阅读 · 0 评论 -
Top K frequency 系列
似乎这类问题还是满经常被遇到的,一直不是特别会,决定把这类问题做一个总结,如果遇到新的时时更新加进来 idea: 通常hashmap 来记录 统计频率 然后minheap(priorityqueue), 这里用minheap而通常不用maxheap,因为frenquency 最小的会在上面,比较和替换比较方便,如果next比当前top k中最小的大,则replace with top and原创 2015-04-06 14:20:35 · 446 阅读 · 0 评论