- 博客(7)
- 收藏
- 关注
原创 Remove Duplicates from Sorted Array II
Given a sorted arraynums, remove the duplicatesin-placesuch that duplicates appeared at mosttwiceand return the new length.Do not allocate extra space for another array, you must do this bymod...
2019-04-29 08:05:31
70
原创 Remove Duplicates from Sorted Array
Given a sorted arraynums, remove the duplicatesin-placesuch that each element appear onlyonceand return the new length.Do not allocate extra space for another array, you must do this bymodifyi...
2019-04-29 07:39:34
86
原创 0-1背包问题
状态方程dp[i][j]=max(dp[i-1][j - w[i-1]] + v[i-1],dp[i-1][j]); for (int i = 1; i <= n ; i++) { //物品 for (int j = 1; j <= maxweight; j++) { //目前的体积 //当前最大价值等于 放 上一件的最大价值 maxvalue[i][j] = ma...
2018-10-24 22:12:42
168
原创 Java Web基础开发的模式——jsp--servlet--service--dao
1. 先简单介绍一下MVC: MVC模式(Model-View-Controller)是软件工程中的一种软件架构模式,把软件系统分为三个基本部分:模型(Model)、视图(View)和控制器(Controller)。* 控制器Controller:对请求进行处理,负责请求转发 -------servlet* 视图View:界面设计人员进行图形界面设计;-------jsp* 模型...
2018-08-30 08:57:49
3264
原创 Java中的注解
1.什么是注解?语法:@注解名称作用:代替xml配置文件2. 定义注解类 @interface A{}//天下所有的注解都是Annotation的子类!定义属性public @interface MyAnn { String value() default "hello world"; //有默认值 int value1();}使用时:@...
2018-08-29 21:51:48
126
原创 JavaWeb中JdbcUtils的实现:使用事务
ThreadLocal 内部时map,以当前线程为键。那么每个线程都有自己的值,互不干扰。必须提供c3p0-copnfig.xml文件import java.sql.Connection;import java.sql.SQLException;import javax.sql.DataSource;import com.mchange.v2.c3p0.ComboPooledD...
2018-08-23 19:18:14
415
原创 Java面试题——多线程
设计4个线程,其中两个线程每次对 j 增加 1 ,另外两个线程对 j 减少 1。借鉴了生产者消费者案例。import java.util.concurrent.locks.Condition;import java.util.concurrent.locks.Lock;import java.util.concurrent.locks.ReentrantLock;public c...
2018-08-21 23:02:37
129
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人