摘要:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.##思路关键是浮点数做key不靠谱,struct hash以及 int calcGCD(int a, ...
阅读全文
摘要:[最近公共祖先LCA](https://github.com/julycoding/The-Art-Of-Programming-By-July/blob/master/ebook/zh/03.03.md)##双链BT如果每个结点都有一个指针指向它的父结点,于是我们可以从任何一个结点出发,得到一个到...
阅读全文
摘要:Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another ex...
阅读全文
摘要:如果不假思索地脱口而出24次,你就被直觉骗了咯
阅读全文
摘要:Given a string s, partition s such that every substring of the partition is a palindrome.
阅读全文
摘要:Given a 2D board and a word, find if the word exists in the grid.
阅读全文
摘要:Sort a linked list in O(n log n) time using constant space complexity.
阅读全文
摘要:在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。输入一个数组,求出这个数组中的逆序对的总数。
阅读全文
摘要:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
阅读全文
摘要:Find the maximum number of flags that can be set on mountain peaks.
阅读全文
摘要:Divide an array into the maximum number of same((-))sized blocks, each of which should contain an index P such that A[P - 1] A[P + 1].
阅读全文
摘要:Given a log of stock prices compute the maximum possible earning.
阅读全文
摘要:Find a maximum sum of a compact subsequence of array elements and any double slice.
阅读全文
摘要:Write a function:int solution(int A, int B, int K);that, given three integers A, B and K, returns the number of integers within the range [A..B] that ...
阅读全文
摘要:####Median of Two Sorted Arrays >There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overa...
阅读全文
摘要:There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costscost[...
阅读全文
摘要:N voracious fish are moving along a river. Calculate how many fish are alive.You are given two non-empty zero-indexed arrays A and B consisting of N i...
阅读全文
摘要:Cover "Manhattan skyline" using the minimum number of rectangles.You are going to build a stone wall. The wall should be straight and N meters long, a...
阅读全文
摘要:Find an index of an array such that its value occurs at more than half of indices in the array.A zero-indexed array A consisting of N integers is give...
阅读全文
摘要:Given an array A of N integers, we draw N discs in a 2D plane such that the I-th disc is centered on (0,I) and has a radius of A[I]. We say that the J...
阅读全文