- 博客(18)
- 资源 (1)
- 收藏
- 关注
原创 LeetCode 338. Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example:For num = 5
2017-01-04 16:24:28 351
原创 LeetCode 419. Battleships in a Board
Given an 2D board, count how many different battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume the following rules:You receiv
2017-01-03 17:19:48 381
原创 Leet Code 104. Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.很简单的一个深度优先搜索的代码...就是找到一颗二叉树的
2016-11-23 21:05:29 290
原创 Leet Code 455. Assign Cookies
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a c
2016-11-23 20:39:06 297
原创 LeetCode 371. Sum of Two Integers
用位操作实现两个整型相加,不允许用加号整型相加主要分为两部分.一部分是相加操作,一部分是进位操作.比如2+3;就是010+011先通过异或运算算出相加的部分010^011 = 001再通过&和010&011 = 010010容易知道001+100的结果其实就是101,也就是5,但是由于这里不让用+操作..所以我们还要递归调用一次.直到没有移位操作的时候,才能结束程序..
2016-11-22 20:47:27 228
原创 Arrays.asList()方法的一个有趣现象
几个测试用的类Class A{}Class B extends A{}Class C extends A{}Class D extends A{}Class E extends B{}Class F extends B{}
2014-10-16 14:02:24 634
原创 quartz入门学习(二)
可重复执行的scheduler,使用simpleTrigger,由于其他代码相同,在这里指给出quartzClass的java代码:quartzClass.java:public class quartzClass {public static void main(String[] args) throws SchedulerException {Scheduler sch
2014-08-15 16:24:37 428
原创 ant入门
一个简单的ant脚本:、逐个解析上诉代码中出现的知识点。1.每个ant必须要有一个project,名字自定义,默认执行run操作,根目录为当前目录(即build.xml所在同级目录)。2.定义属性,名称为lib,值为lib也可以这样写这样表示的意思为讲pr
2014-08-06 17:55:45 334
原创 Iterator简简简简析-_-!
关于hashsetHashset中保存的是非相同的值,当保存的值已经存在于hashset中时,add操作将会失效,而Arraylist则不会.遍历HashSet或者是ArrayList时,可以采用迭代器的方法.即SetuserSet=new HashSet();Iteratorit=userSet.Iterator();While(it.hasNext()){Use
2014-07-23 20:29:51 403
原创 Hibernate多对多@ManyToMany及多对一@ManyToOne学习
1. 多对多映射(@ManyToMany)比如:班级和课程,一个班级可以对应多个课程,一个课程可以对应多个课程,故班级和课程之间的关系应当是多对多.那么,在写Hibernate的注解时就可以这么写…(加粗加斜加红部分)Course类:@Entity@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)@Tab
2014-07-23 20:24:18 690
原创 Struts2和SpringMVC数据模式简析
1.struts2和spring MVC的数据绑定方式:Struts2中的数据绑定主要有三种.其中使用比较广泛的是域模型模式在jsp页面中,有一个表单 在action层.这样写,会将user类直接注入进来,当执行到action层的函数的时候,会根据jsp页面中的text的name属性进行匹配,user.userName会匹配user类中
2014-07-23 20:24:18 492
原创 通过ajax,添加table中的内容
1. ajax的写法:$.ajax({Type:”get”,(or post) 表示是以get方式还是以post方式进行访问url:item/showItem, 表示要访问的是项目根目录下的item/showItem路径data:{userId,1}, json形式的写法,{xxx,xxxx}表示xxx的值为xxxxdatatype:js
2014-07-23 20:19:17 944
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人