- 博客(21)
- 收藏
- 关注
原创 java解析xml文件
使用dom4j来解析xml文件,例子为根据url获取天气信息的xml文件,在文件中解析所需要的数据。难点是遇到scheam不知道如何处理,后来通过elements().get(id)解决。解析步骤:1.SAXReader reader = new SAXReader();2.Document document = reader.read(url);3.package
2014-11-07 14:24:11 369
原创 Balanced Binary Tree
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { priva
2014-09-12 23:07:33 289
原创 Binary Tree Postorder Traversal
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { publi
2014-09-12 09:58:30 317
原创 Binary Tree Inorder Traversal
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { publi
2014-09-12 00:04:00 280
原创 Binary Tree Preorder Traversal
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { publi
2014-09-11 23:45:37 264
原创 Best Time to Buy and Sell Stock
public class Solution { public int maxProfit(int[] prices) { int profit = 0; if(null == prices || prices.length < 1) return profit; for(int i=0; i<prices.length
2014-09-11 13:48:33 298
原创 Best Time to Buy and Sell Stock II
public class Solution { public int maxProfit(int[] prices) { int profit = 0; if (null == prices || prices.length == 0) return profit; int hold = prices[0];
2014-09-11 13:35:00 239
原创 Reverse Integer
public class Solution { public int reverse(int x) { int result = 0; int temp = Math.abs(x); while(temp != 0){ result =result * 10 + temp % 10; temp
2014-09-10 15:19:24 259
原创 Same Tree
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { publi
2014-09-10 14:31:09 200
原创 Maximum Depth of Binary Tree
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { publi
2014-09-10 13:57:21 203
原创 Single Number
public class Solution { public int singleNumber(int[] A) { int result = 0; for(int i=0; i<A.length; i++){ result = result ^ A[i]; } return result; }
2014-09-10 13:25:26 228
原创 大数运算
1#include #include #include #define N 20char * bigNumPlus(const char *a, const char *b, char *c){ int na[N]; int nb[N]; int nc[N]; memset(na, 0, N * sizeof(int)); memset(nb,
2014-09-10 11:17:34 319
原创 2014互联网找工作总结(编程)
1.读程序,解释运行结果#include #include void main(){ int a[2000]; char *p = (char *)a; int i; for(i = 0; i < 2000; i++) a[i] = -i - 1; printf("%d\n",strlen(p));}
2014-09-05 19:35:33 528
原创 Python Challenge 通关攻略
1.import stringtext = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamk
2014-09-03 16:02:29 470
转载 windows C盘的用户文件夹迁移
在shijix即:C:\Users --》X:\Users好处:减少C盘空间的压力,防止系统损坏对个人数据的影响。一、新系统安装时:在安装Win7的过程中,要求输入用户名及密码的时候,先不如输入任何信息,按“Shift+F10”呼出DOS窗口,依次输入以下命令: robocopy "C:\Users" "X:\Users" /E /COPYALL /
2014-09-03 13:31:25 12708
原创 Single Number(c++)
Single Number Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implemen
2014-04-17 18:45:07 500
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人