awangdev / leet-code Goto Github PK
View Code? Open in Web Editor NEWJava Solutions to problems on LintCode/LeetCode
Java Solutions to problems on LintCode/LeetCode
你好,无意中看到了你的这个文章,作为一个对coding完全不开窍的人来说,如获珍宝,谢谢分享。先刚尝试刷题,对任何题目都没有什么思路,无从下手,可不可以传授一点经验?recursion完全不懂,BDFS也不懂,可不可以开个专题讲一下对一个题目为什么我就需要用recursion和BDFS,如果用参数怎么定义?方法体怎么去思考写出来?谢谢
(Integer.MAX_VALUE,100)
您好,可不可以讲解下您是如何将 Wildcard Matching 中原本m * n
的dp array 利用滚动数列 转化成 2 * n
的 dp array?
我注意到您用到了两个variable
int curr = 0;
int prev = 1;
我不太明白这两个varibale具体的意义何在,以及您是如何应用这两个variable 的
谢谢
https://github.com/awangdev/LintCode/blob/master/Java/Partition%20Array.java#L54 won't work for [9, 4, 1, 8, 5, 10, 6, 3, 7, 2], pivot = 7
Iteration 1:
low = 0
high = 9
swap(0,9) -> [2, 4, 1, 8, 5, 10, 6, 3, 7, 9]
Iteration 2:
low = 3
high = 7
swap(3,7) -> [2, 4, 1, 3, 5, 10, 6, 8, 7, 9]
Iteration 3:
low = 5
high = 6
swap(5,6) -> [2, 4, 1, 3, 5, 6, 10, 8, 7, 9]
Iteration 4:
low = 6
high =5
Array is not partitioned, returns 6.
T_T
"For ReverseInteger I thought maybe you would like to see a different approach for this problem, this is what I would do:
public int reverse(int x) {
int ne=x<0 ? -1 : 1;
x=Math.abs(x);
long a=x%10;
x/=10;
while (x!=0){
a*=10;
a+=x%10;
if(a < Integer.MIN_VALUE || a > Integer.MAX_VALUE)return 0;
x/=10;
}
return Long.valueOf(a*ne).intValue();
}"
//Find the num1,num2 in original array and record the index
这块,应该是
rst[0] = i ;
rst[1] = i;
Trapping Rain Water II.java 90-110行,四个角上的元素是不是被重复放入了。但是不影响结果的正确性。
大拿,从知乎跟过来的,感激不尽,收藏,啃
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.