摘要:
What is a high-performance data structure? To answer that question, we're used to applying normal considerations like Big-Oh complexity, and memory ov... 阅读全文
摘要:
在线求第k个数做得多了,在线求中位数也是用堆,一个最大堆,一个最小堆。思想大概是这样子的:一个最大堆,一个最小堆,最大堆对应于前n/(n+1)个数,最小堆对应于后n/n+1个数;假设最大堆堆项元素为n1, 最小堆堆顶为n2, 则n1 s2, 那么:如果m >= n1, m插入到最小堆,s2=s2+... 阅读全文
摘要:
不能对自己期望太大,但总是要拼一拼。只求能够发挥自己最好的状态,打一场酣畅淋漓的仗。bless!最后两场重要的战斗,good luck!update:昨天其实整体来说发挥也算正常,早上遇到leetcode原题,但因为是英语面,所以一直紧张,这一点觉得略有问题,code还是不够clean,有点小bug... 阅读全文
摘要:
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below a... 阅读全文
摘要:
Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:Did y... 阅读全文
摘要:
Write a function to find the longest common prefix string amongst an array of strings. 1 class Solution { 2 public: 3 string longestCommonPrefix(v... 阅读全文
摘要:
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and ... 阅读全文
摘要:
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font ... 阅读全文
摘要:
Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->... 阅读全文
摘要:
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your alg... 阅读全文