自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

a731604348的博客

这个博客用来总结自己学的一些知识,有些总结是以前写的,后来才搬到博客上,当时并没有意识到资料引用要标明出处,侵删

  • 博客(45)
  • 收藏
  • 关注

原创 64. Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at any...

2018-04-25 17:25:55 197

原创 62. Unique Paths

A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bott...

2018-04-25 17:20:43 230

原创 78. Subsets

Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Example:Input: nums = [1,2,3]Output:[ [3],  [1],  [2...

2018-04-25 17:11:41 222

原创 56. Merge Intervals

Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].题目:给定的间隔中,如果有 重叠的,就组合在一起,大概意思看例子应该就能懂了思路:一开始的想法是先根据end,进行由小到大的...

2018-04-04 11:56:56 248

原创 49. Group Anagrams

Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat"

2018-04-03 20:02:20 170

原创 86. Partition List

Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of the...

2018-04-03 00:48:49 130

原创 11. Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two ...

2018-03-21 17:07:28 156

原创 34.Search for a Range

Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target i...

2018-03-21 11:56:16 122

原创 22. Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())", "...

2018-03-15 00:03:39 133

原创 27. Remove Element

Given an array and a value, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input array in-place ...

2018-03-13 21:51:55 132

原创 14. Longest Common Prefi

Write a function to find the longest common prefix string amongst an array of strings。给定一个字符串数组,找出数组内所有字符串共同的字符串前缀题比较简单,直接上代码public String longestCommonPrefix(String[] strs) { if(strs != null) ...

2018-03-13 21:47:32 171

原创 对常见排序算法的总结(选择、插入、希尔、归并、快速、堆排序)

1.选择排序首先,第一轮循环,取第一个数,与数组中接下来的数进行比较,找到数组中最小的数,与第一个数交换;第二轮循环,取第二个数,与数组中接下来的数进行比较,找到数组中最小的数,与第二个数交换...大概有N^2/2次比较,N次交换2.插入排序对于数组a[],第一轮循环,i=1,j=i,如果a[j]小于a[j-1],两者值交换,j--,继续判断,直到j=0;第二轮循环,i=2,j=i,如果a[j]小...

2018-03-13 21:43:40 185

原创 leetcode 15.3Sum

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contain dupli...

2018-03-07 16:29:38 150

原创 总结自己第一个python爬虫

刚开始学的python,做的第一个爬虫练习,有不足之处 见谅使用BeautifulSoup、requests两个库,爬的是58同城的转转,页面是随便点进去的# -*- coding: UTF-8 -*-from bs4 import BeautifulSoupimport requestsurl = "http://gz.58.com/iphonesj/";def get

2018-01-07 21:48:48 247

原创 SpringMVC 常用注解 及 其用法 (下)

-----处理json问题,前端接受、发送json数据,或者控制器接收、发送json数据需要包jackson-jr-all-2.4.3.jar;jackson-annotations-2.6.0.jar;jackson-core-2.6.0.jar;jackson-databind-2.6.0.jarspring4如下配置

2017-08-30 18:39:04 340

原创 SpringMVC 常用注解 及 其用法 (上)

只记录注解相关,springmvc配置方面就不再赘述了1.在springmvc配置文件头中加入xmlns:context="http://www.springframework.org/schema/context"http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/

2017-08-30 18:14:52 311

原创 java异常:org.springframework.beans.ConversionNotSupportedException

org.springframework.beans.ConversionNotSupportedException原因:Spring注入的是接口,关联的是实现类,使用的是jdk自带的代理方法。      所以如果你在类中声明的属性(例如自己写的带有接口的类)的数据类型是实体类,就会报这种错误解决:使用cglib代理的方法,在spring配置文件中加入后就可以在类中声

2017-04-30 01:26:30 5116 1

原创 leetcode 59. Spiral Matrix II (螺旋矩阵)

Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [

2017-04-24 09:18:29 393

原创 leetcode 48. Rotate Image(矩阵旋转)

You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?将矩阵顺时针旋转90度。思路:先在纸上画一个3x3的矩阵,在画出它旋转90度之后的图形,观察其变化----------------...

2017-04-20 00:46:40 291

原创 leetcode 12.IntegertoRoman(整形转罗马数字)

Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.将给定的数字转换为罗马数字,范围为(1~3999)罗马数字的组成规则自己网上找思路:观察可得罗马数字(1~3999)的组成分为4种类型,

2017-04-13 22:13:35 309

原创 leetcode 535. Encode and Decode TinyURL(长短网址互译)

TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http://tinyurl.com/4e9iAk.Design the encode and

2017-04-13 00:38:11 2446

原创 leetcode 46. Permutations(考全排列)

Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1

2017-04-10 00:26:23 640

原创 ajax基础 和 Jquery的ajax

ajax:通讯对象,浏览器的内置异步对象,默认情况下没有被创建出来IE中的对象叫ActiveXObject,高版本的ie才叫XMLHttpReques,两者均可使用其他浏览器叫XMLHttpRequest判断浏览器类型:网上搜吧原理:当触发有ajax功能的事件时,会将请求发送给浏览器内置异步对象,经过包装后发送给服务器,之后服务器处理后以 流 的形式发送给浏览器内置

2017-04-04 17:47:14 296

原创 通用dao写法 (spring4+hibernate4),主要是反射泛型

通用Dao写法1.定义BaseDao接口,IBaseDao,定义了增删查改方法;2.实现BaseDao接口,有属性sessionFactory;由于要使泛型T能够实例化才能进行增删查改方法,所以要有构造方法,初始化Class clazz属性,这里用到反射泛型,来获取子类的类型,然后重写接口里的方法,利用构造方法初始化的泛型得知类名,进行增删查改方法的重写3.每个Dao子类继承2中的Ba

2017-04-04 17:13:45 979

原创 spring3整合hibernate4

resources.prioperties文件中有db.driverClass=com.mysql.jdbc.Driverdb.url=jdbc:mysql://localhost:3306/数据库名db.username=rootdb.password=123db.maxPoolSize=50在spring配置文件中配置 classpath:r

2017-04-04 16:46:44 584

原创 spring3整合struts2

action名字中可以出现“/”,就要在struts2配置文件中配置struts.enable.SlashesInActionNames=true除了struts2本身的配置文件外,还要做下列的事在struts.xml文件中配置使得struts2能在spring的配置文件中读取action。action的名字需要与在spring配置文件中的bean名字相

2017-04-04 16:39:22 381

原创 spring aop原理

AOP的部分原理静态代理:定义DAO接口A,类B实现接口A,并重写A的方法method,代理类C实现接口A,也重写A的方法method,然后在这个method方法中开启事务,调用B的method方法,关闭事务好处:在不修改目标对象的功能的前提下,增添新方法缺点:每个对象都需要有代理对象,导致有很多代理类      接口增加方法,所有的实现类都要改动态

2017-04-04 16:27:30 172

原创 Filter基础

Filter的开发流程:      1.创建一个类,实现javax.servlet.Filter接口,实现其中三个方法init(FilterConfig filterConfig)doFilter(ServletRequest request,ServletResponse,FilterChain chain)destroy()其中,doFilter()方法中需要用chain.

2017-04-04 16:06:04 291

原创 异常:unknow entity

unknow entity原因:找不到实体类,可能是spring配置bean时出错,或者类dao方法出错(c、r、u、d时传入单字节码文件)

2017-04-04 15:59:30 637

原创 异常:could not obtain transaction-synchronized

could not obtain transaction-synchronized原因:配置文件没配好,spring3整合hibernate4时,事务要交给spring管理,才能使用currentSession不使用注解情况下,要在spring配置文件中配置自动事务

2017-04-04 15:58:38 1097

原创 异常:java.lang.ClassNotFoundException: org.hibernate.engine.FilterDefinition

java.lang.ClassNotFoundException: org.hibernate.engine.FilterDefinition报错原因:spring和hibernate版本不对应解决办法:在bean配置文件中org.springframework.orm.hibernate4.LocalSessionFactoryBean类的注入中,spring对应的hib

2017-04-04 15:56:02 564

原创 异常:org.springframework.beans.factory.BeanNotOfRequiredTypeException

org.springframework.beans.factory.BeanNotOfRequiredTypeException 使用spring的AOP切面动态代理时,报错原因:动态代理时使用的是spring自己生成的代理类,而配置文件中使用的是接口解决方法:在配置中加入

2017-04-04 15:54:33 347

原创 异常:前端发送几次请求后,浏览器一直等待localhost响应

前端页面进行查询操作几次后,或者向后台发送几次请求之后浏览器一直显示等待localhost响应原因:数据库传送资源后没有及时关闭,导致后面的数据传送出现阻塞解决方法:在次jdbc每次对数据库进行操作后要及时关闭操作接口

2017-04-04 15:53:55 9559 3

原创 异常:NoClassDefFoundError或Could not initialize class

相符加载到服务器的时候不能运行出现,使用第三方的包出现NoClassDefFoundError或Could not initialize class原因:可能是编译的时候没问题,但是class运行时连接内存找不到,或者第三方jar包冲突,或者没有加进来解决方法:将第三方jar包放到项目的lib目录下

2017-04-04 15:51:03 2624

原创 异常The last packet sent successfully to the server was 0 milliseconds ago...

使用阿里的druid包出现有The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.或者单纯使用jdbc提示No operations allowed after connection close

2017-04-04 15:49:40 532

原创 EL表达式和JSTL标签库

EL表达式:用于jsp页面,获取后台的数据,或者后台通过它获取数据,简便在指定作用域中取得共享数据${pageScope.属性名}在page域取得数据,其他以此类推,requestScope、sessionScope、applicationScope如果没有写作用域,默认顺序是pageContext 访问对象的属性的写法:${对象.属性名}或者$

2017-04-04 00:25:00 202

原创 servlet的三大作用域对象和jsp的九大内置对象及其四大作用域对象

servlet的三大作用域对象:request(HttpServletRequest)session(HttpSession):application(ServletContext):tomcat启动时创建,tomcat关闭时销毁,整个web的生命周期只有一个括号内为其对应的类jsp的九大内置对象:pageContext(pageContext)request(HttpServletRequest...

2017-04-03 23:46:36 16792 4

原创 请求转发,请求包含,url重定向,<jsp:include> ,<%@include>区别

请求转发:RequestDispatcher getRequestDispatcher(String path);//获取请求分发器void forward(ServletRequest request,ServletResponse response);//请求转发一般写法:request.getRequestDispatcher("/路径").forward(reque

2017-04-03 12:03:21 1757

原创 getAttribute和getParameter的区别

getAttribute:1.一般在前台用与获取后台转发值,返回的是Object,需进行转换,可用setAttribute设置成任意对象;2.getAttribute表示从request范围取得设置的属性,必须要先setAttribute设置属性,才能通过getAttribute来取得,设置与取得的为Object对象类型3.只会存在于Web容器内部getParameter:

2017-04-03 11:56:44 403

原创 java内省机制

JavaBean:一种可重用的,遵循一定的设计规范的类规范如下:1.类是public类型2.有公告无参构造器3.属性私有,包含属性的get、set方法java内省机制:通过反射操作JavaBean的属性,一般应用于框架底层一般步骤:1.获取JavaBean的BeanInfo对象,此方法需抛异常BeanInfo info = Introspector.ge

2017-04-03 11:43:05 303

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除