- 博客(110)
- 收藏
- 关注
原创 leetcode valid panlidrome
public class Solution { public boolean isPalindrome(String s) { // Start typing your Java solution below if(s.length() == 1 || s.length() == 0 ) return true; Strin
2013-10-02 11:29:37
737
转载 leetcode edit distance
public int minDistance(String word1, String word2) { // int rowNum = word1.length(); int colNum = word2.length(); int[][] dist = new int[rowNum + 1][colNum + 1]; for
2013-09-20 07:47:34
523
原创 Leetcode Climbing Stairs
public int climbStairs(int n) { // Start typing your Java solution below // DO NOT write main() function if(n == 0) return 0; if(n == 1) return 1; int[] arr = new
2013-09-12 04:51:08
614
原创 leetcode plus one
public int[] plusOne(int[] digits) { if(digits.length < 1) return null; String ans = ""; int resi = 0; for(int i = digits.length - 1; i>=0; i--) { int cu
2013-09-12 04:37:33
603
原创 leetcode add binary
public String addBinary(String a, String b) { // char resi = '0'; int lena = a.length(); int lenb = b.length(); int len = (lena > lenb ? lena : lenb) - 1; int i
2013-09-12 02:27:20
519
原创 leetcode merge two sorted list
public ListNode mergeTwoLists(ListNode l1, ListNode l2) { // Start typing your Java solution below // DO NOT write main() function ListNode ans = new ListNode(0); ListNode he
2013-09-11 08:30:26
408
原创 leetcode minimum path sum
DPMin[ i, j] = Min( Min[i - 1][j] + grid[i][j], Min[i][j - 1] + grid[ i ][ j ]); public int minPathSum(int[][] grid) { // Start typing your Java solution below [[1]] //
2013-09-11 08:12:44
401
原创 leetcode length of last word
public class LastWordLength { public int lengthOfLastWord(String s) { // if(s == null || s.length() == 0 ) return 0; s = s.trim(); s = s.replaceAll("[ ]+", " ");
2013-08-13 05:47:46
408
原创 leetcode insert interval
Iterate the intervals list. Compare newInterval with each item in the list. If overlapping, update the item. Otherwise(no overlapping), add newInterval into list. Then delete duplicates or merge overl
2013-07-26 08:45:15
427
原创 leetcode merge intervals
import java.util.ArrayList;import java.util.Collections;import java.util.Comparator;class Interval { int start; int end; Interval() {start = 0; end = 0;} Interval(int s, int e) {start = s; end
2013-07-25 05:28:22
475
原创 leetcode Jump Game
/* Leetcode JumpGameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that posi
2013-07-20 08:26:53
444
原创 leetcode spiral matrix
public ArrayList spiralOrder(int[][] matrix) { // ArrayList result = new ArrayList(); if(matrix == null) return result; if(matrix.length < 1) return result;
2013-07-20 08:13:23
383
原创 leetcode maxSubArray
O(n) solutionpublic class MaxSubArray { public int maxSubArray(int[] A) { int sum = 0, curr = 0; int max = Integer.MIN_VALUE; for(curr = 0; curr < A.length; curr++) {
2013-07-18 02:14:50
470
原创 leetcode pow
public class Pow {// //recursive version// //stack overflow when n is large// public double pow(double x, int n) {// // if(n < 0) {// return 1.0/pow(x, -n);// }// /
2013-07-17 02:58:08
448
原创 leetcode anagrams
import java.util.ArrayList;import java.util.Arrays;import java.util.HashMap;/* * Given an array of strings, return all groups of strings that are anagrams. * Note: All inputs will be in lower-c
2013-07-16 08:34:35
411
原创 Leetcode Permutation II
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[1,1,2], [1,2,1], and [2,1,1
2013-07-16 07:56:00
422
转载 Java Object, Json 转换
总目录索引: http://www.cnblogs.com/hoojo/archive/2011/04/27/2030264.htmlJackson: http://blog.csdn.net/IBM_hoojo/article/details/6340762
2013-06-18 11:20:58
434
转载 Java XML Read
http://blog.csdn.net/smcwwh/article/details/7183869SAX: http://blog.csdn.net/lifaming15/article/details/1749695The entity "nbsp" was referenced, but not declared.http:/
2013-06-16 17:49:09
379
转载 LeetCode Combination Sum
Good Article: http://blog.csdn.net/zyfo2/article/details/8592955
2013-05-05 07:18:09
438
转载 JSON java 读取
JSON eclipse 库文件及教程:http://json-lib.sourceforge.net/index.htmlJSON 的介绍 : http://www.json.org/json-zh.html
2013-04-28 11:36:36
924
原创 Lucene 自定义score + pageRank
http://blog.sina.com.cn/s/blog_6cc084c90100oiy6.htmlhttp://blog.sina.com.cn/s/blog_6cc084c90100ojhr.html
2013-03-15 11:29:52
774
原创 CareerCup 16.3 Philosopher Dinner -- DeadLock, Synchronized
package CareerCup;import java.util.concurrent.locks.Lock;import java.util.concurrent.locks.ReentrantLock;class Chopstick { private Lock lock; Chopstick() { lock = new ReentrantLock(); } pub
2013-03-09 17:52:13
450
原创 CareerCup 14.6
Implement Circular Array/* * Career Cup 14.6 * */package CareerCup;import java.util.Iterator;public class CircularArray implements Iterable { private T items[]; private int head; p
2013-03-08 16:04:31
522
原创 CareerCup 5.7 & 13.1
CareerCup 5.7 Missing Number#include #include using namespace std;bool fetchBit(int num, int column) { if(column = 32) return -1; return ((num & (1 << (31 - column))) != 0 );}int findMis
2013-03-08 14:17:44
561
原创 CareerCup 4.1 & 4.3
CareerCup 4.1//============================================================================// Name : CareerCup41.cpp// Author : SK2// Version :// Copyright : Your copyright not
2013-03-08 14:14:40
565
原创 CareerCup2.5
//============================================================================// Name : Career25.cpp// Author : SK2// Version :// Copyright : Your copyright notice// Description
2013-03-08 14:13:16
463
转载 OpenGL 入门
http://www.cppblog.com/doing5552/archive/2009/01/08/71532.htmlhttp://anony3721.blog.163.com/blog/static/51197420114215753871/http://blog.csdn.net/nauty_li/article/category/374761
2012-12-03 09:01:07
184
转载 Android之googleMap
http://www.cnblogs.com/zhangdongzi/archive/2012/01/13/2321754.html
2012-11-13 03:23:50
231
转载 C++ 复制文件的n种方法
见此牛人http://stackoverflow.com/questions/10195343/copy-a-file-in-an-sane-safe-and-efficient-way特别推荐使用c++的缓冲流 cdbuf()http://blog.csdn.net/sszgg2006/article/details/7469539http://blog.csdn.n
2012-10-30 15:06:10
2801
转载 卷积
http://www.codeforge.com/read/63343/%E4%BA%8C%E7%BB%B4%E5%8D%B7%E7%A7%AF%E8%BF%90%E7%AE%97%E4%B9%8BC%E8%AF%AD%E8%A8%80%E5%AE%9E%E7%8E%B0.txt__htmlhttp://hi.baidu.com/foolwish/item/92f40e4456d38f
2012-10-22 11:08:19
230
转载 图像处理 卷积 Convolution
http://www.developer.com/java/other/article.php/3579206/Processing-Image-Pixels-Understanding-Image-Convolution-in-Java.htmhttp://www.developer.com/java/other/article.php/3484591/Convolution-a
2012-10-13 15:46:44
381
原创 USACO Home on the Range
参考USACO,使用的动态规划 http://www.nocow.cn/index.php/USACO/range代码/* ID: wangxin12 PROG: rangeLANG: C++ */#include #include #define MAX 253using namespace std;ofstream fo("range.out"
2012-10-02 13:05:40
330
转载 关于C++ const 的全面总结
http://blog.csdn.net/Eric_Jo/article/details/4138548 C++中的const关键字的用法非常灵活,而使用const将大大改善程序的健壮性,本人根据各方面查到的资料进行总结如下,期望对朋友们有所帮助。Const 是C++中常用的类型修饰符,常类型是指使用类型修饰符const说明的类型,常类型的变量或对象的值是不能被更新的。
2012-10-02 11:37:21
271
原创 USACO Camelot,难题
http://usacotraining.blogspot.com/2012/08/problem-333-camelot.htmlsomething about github http://blog.sina.com.cn/s/blog_4b55f6860100zzgp.html
2012-09-28 14:40:40
333
原创 USACO Shopping Offers, DP
无语致死,使用的最原始的五维DP,参考 http://www.cppblog.com/Ylemzy/articles/100170.html注意count数组里除了要加入 捆绑打折的商品信息,也要加入商品的单价/* ID: wangxin12 PROG: shopping LANG: C++ */#include #include using namespace st
2012-09-26 08:01:09
300
转载 如何利用LinkedIn 建立美国人脉
如何利用LinkedIn 建立美国人脉LinkedIn的强大之处,在此不容多说,股票价格的确能够反映公司的市场地位。在此,建议毕业前1年的Pacer(最好读完一个学期后)通过它找寻找工作并扩大自己的“能力圈”。百度名片对LinkedIn的解释:LinkedIn是一家面向商业客户的社交网络(SNS)服务网站,成立于2002年12月并于2003年启动。网站的目的是让注册用户维护
2012-09-22 13:47:07
1753
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人