leetcode
mengli / leetcode Goto Github PK
View Code? Open in Web Editor NEWleetcode
leetcode
蒙拿,你这题的code大数据超时呀,O(N^2)的算法复杂度要超时的。
需要O(N)的算法才能过的。
https://github.com/xiongjunliang/leetcode/blob/master/stock3/stock3.cpp
当两个数中的一个加完了之后,如果这是advance为0,表示不用进位了,那剩下的字符只要照搬就行了~ 不需要再add了
RemoveDuplicatesfromSortedArray
when input is int[] a = {1,1,2}
the output array is {1,2,2}
I think java array cannot finish this task.
https://github.com/mengli/leetcode/blob/master/PalindromeNumber.java#L26
Your output is error when the input is 1021 or 10021.
we should change it to:
while(x != 0) {
https://github.com/mengli/leetcode/blob/master/ImplementStrStr.java#L22
Thanks for your code. But I found an issue in you code, as below snippet:
if (a >= len1 || haystack.charAt(a) != needle.charAt(b)) {
match = false;
break;
}
I think that we can change it to:
if ( haystack.charAt(a) != needle.charAt(b)) {
if (a >= len1) return null;
match = false;
break;
}
will make sense.
I enjoyed reading your code for MaxPointsOnALine.java
URL:
https://github.com/mengli/leetcode/blob/master/MaxPointsOnALine.java#L30
After reviewing your code, it seems that it's only comparing the slope value and not including calculation for the x or y intercepts. However, shouldn't you include that in your comparisons since two different lines can have the same slope but different x or y intercepts.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.