自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(116)
  • 资源 (3)
  • 收藏
  • 关注

原创 leetcode 13. Roman to Integer

题目Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.解class Solution { public int romanToInt(String s) { HashMap<Character,Integer>

2018-01-07 15:52:45 293

原创 leetcode 9. Palindrome Number

题目Determine whether an integer is a palindrome. Do this without extra space.解class Solution { public boolean isPalindrome(int x) { if(x<0) return false; int y=x; int res=0;

2018-01-07 15:34:35 278

原创 leetcode 14. Longest Common Prefix

题目Write a function to find the longest common prefix string amongst an array of strings.解class Solution { public String longestCommonPrefix(String[] strs) { //return ""; if(s

2018-01-07 15:29:42 286

原创 leetcode 7.Reverse Integer

题目Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123 Output: 321 Example 2:Input: -123 Output: -321 Example 3:Input: 120 Output: 21 Note: Assume we are dealing wit

2018-01-03 22:39:46 302

原创 leetcode 1.Two Sum

题目Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same e

2018-01-02 20:23:12 228

原创 leetcode 461. Hamming Distance

题目The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Note: Example The above

2017-12-30 22:01:35 222

原创 一个简单登录的SpringMVC的示例

一.框架图二.步骤1./WebRoot/WEB-INF/lib下添加SpringMVC必须的jar包; 2.在com.xml.models包中创建User类,该类包含两个属性:username和password,并分别实现这两个属性的setXxx()和getXxx()方法。package com.xml.models;public class User { private String u

2016-12-29 13:46:16 2468

原创 一个简单的Hibernate的示例

一.框架图二.步骤1.建立数据库javaweb(使用的是MySQL数据库); 2./WebRoot/WEB-INF/lib下添加个Hibernate必须的jar包; 下载地址:http://download.csdn.net/detail/decorator2015/9711169 (比较特别的是mysql-connector-java-5.0.8-bin.jar和log4j.jar,这俩个包

2016-12-14 14:49:40 449

原创 一个简单登录的Struts2的示例

一. 框架图二.步骤1./WebRoot/WEB-INF/lib下添加7个Struts2必须的jar包; 下载地址 2.web.xml中配置关于Struts2的filter; 3.建立Login.jsp, LoginFailure.jsp以及LoginSuccess.jsp文件; 4.建立UserAction.java文件; 4.src下建立struts.xml文件;三.源代码3.1web

2016-12-13 14:25:07 913 1

原创 MyEclipse报错:Multiple markers at this line - The type java.io.ObjectInputStream cannot be resolved.

1.出错原因网上查了以后,说是因为JDK版本太高的问题2.修改window->preference->Java->Installed JREs->选择低版本的JDK->ok ps:这里由于我只装了JDK1.8,所以选择可以MyEclipse自己的JDK(即Sun JDK 1.6.0_13)3.小结版本兼容问题

2016-11-22 10:25:27 20571 2

原创 leetcode 371. Sum of Two Integers

题目Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example: Given a = 1 and b = 2, return 3.提示位运算解public class Solution { public int getSum(int a, int

2016-07-05 11:16:08 581

原创 剑指offer-面试题25:二叉树中和为某一值的路径

题目输入一棵二叉树和一个整数,打印出二叉树中结点值的和为输入整数的所有路径。从树的根结点开始往下一直到叶结点所经过的结点形成一条路径。二叉树的定义如下:class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } public TreeNode() {

2016-06-20 16:01:05 498

原创 剑指offer-面试题24:二叉搜索树的后序遍历序列

题目输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。如果是则返回true,否则返回false。假设输入的数组的任意两个数组都互不相同。解package Chapter4;public class VertifySquenceOfBST { boolean vertifySquenceOfBST(int[] sequence,int start,int end){

2016-06-20 11:41:08 415

原创 剑指offer-面试题22:栈的压入,弹出序列

题目输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序。假设压入栈的所有数字均不相等。例如序列1,2,3,4,5是某栈的压入序列,序列4,5,3,2,1是该压栈序列对应的一个弹出序列,但4,3,5,1,2就不能是该栈序列的一个弹出序列。解import java.util.Stack;public class PopOrder { boolean IsPopOrd

2016-06-17 14:04:07 450

原创 剑指offer-面试题21:包含min函数的栈

题目定义栈的数据结构,请在该类型中实现一个能够得到栈的最小元素的min函数。在该栈中,调用min,push及pop的时间复杂度都是O(1)。解import java.util.Stack;public class StackWithMin { Stack<Integer> m_data=new Stack<Integer>();//数据栈 Stack<Integer> m_min=ne

2016-06-17 11:52:14 383

原创 剑指offer-面试题20:顺时针打印矩阵

题目输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字。解void PrintMatrixClockwisely(int[][] nums,int columns,int rows){ if(nums==null||columns<=0||rows<=0){ return; } int start=0; wh

2016-06-16 15:23:50 412

原创 剑指offer-面试题18:树的子结构

题目输入两棵二叉树A和B,判断B是不是A的子结构。二叉树结点的定义如下:public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } public TreeNode() { // TODO Auto-generated c

2016-06-16 11:56:11 431

原创 剑指offer-面试题12:打印1到最大的n位数

题目输入数字你,按顺序打印出从1最大的n位十进制数。比如输入3,则打印出1,2,3一直到最大的3位数即999。解public void PrintToMaxOfNDigits(int n){ if(n<=0) return; int[] number=new int[n]; while(Increment(number)){

2016-06-14 14:08:39 316

原创 剑指offer-面试题11:数值的整数次方

题目实现函数double Power(double base,int exponent),求base的exponent次方,不得使用库函数,同时不需要考虑大数问题。解 double Power(double base,int exponent){ double result; if(equal(base,0.0) && exponent<0){

2016-06-13 15:06:28 333

转载 leetcode 235. Lowest Common Ancestor of a Binary Search Tree

题目Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between t

2016-06-13 12:01:34 332

原创 leetcode 205. Isomorphic Strings

题目Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with another cha

2016-06-13 11:46:28 320

原创 leetcode 299. Bulls and Cows

题目guess, you provide a hint that indicates how many digits in said guess match your secret number exactly in both digit and position (called “bulls”) and how many digits match the secret number but loc

2016-06-13 11:00:05 429

原创 leetcode 88. Merge Sorted Array

题目Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold addition

2016-06-13 10:35:10 296

原创 leetcode 223. Rectangle Area

题目Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure. Assume that the total area

2016-06-13 10:00:02 409

原创 剑指offer-面试题8:旋转数组中的最小数字

题目把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。输入一个递增排序的数组的一个旋转,输出旋转数组的最小元素。例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小元素为1.解public int Min(int[] nums){ if(nums.length==1){//只有一个元素 return nums[0];

2016-06-06 17:01:06 404

原创 leetcode 219. Contains Duplicate II

题目Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.解1(超时)pub

2016-06-06 15:10:59 318

转载 leetcode 160. Intersection of Two Linked Lists

原文链接:http://blog.csdn.net/litoupu/article/details/41555557题目Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists: be

2016-06-06 14:54:12 342

原创 Java:栈(Stack)和队列(Queue)的使用

Stack 1–>public Stack() 创建一个空堆栈 2–>public boolean empty() 测试堆栈是否为空; 3–>public E pop() 移除堆栈顶部的对象,并作为此函数的值返回该对象。 4–>public E push(E item) 把项压入堆栈顶部 5–>public E peek() 查看堆栈顶部的对象,但不从堆

2016-06-06 12:01:01 7627

原创 leetcode 225. Implement Stack using Queues

题目Implement the following operations of a stack using queues.push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top() – Get the top element. empty() – Return wheth

2016-06-06 11:22:45 371

原创 leetcode 232. Implement Queue using Stacks

题目Implement the following operations of a queue using stacks.push(x) – Push element x to the back of queue. pop() – Removes the element from in front of queue. peek() – Get the front element. empty(

2016-06-06 10:42:52 284

原创 二叉树的遍历

二叉树的定义public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } public TreeNode() { // TODO Auto-generated constructor stub }}1,重建pu

2016-06-03 14:48:53 375

原创 剑指offer-面试题6:重建二叉树

题目输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。解public static TreeNode buildTree(int[] preOrder, int start,int[] inOrder,int end,int length){ //参数验证 if(preOrder=

2016-06-03 14:14:13 388

原创 leetcode 172. Factorial Trailing Zeroes

题目Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.解public class Solution { public int trailingZeroes(int n) { //计

2016-06-02 15:33:15 259

原创 HTTP 状态码

HTTP状态码(HTTP Status Code)是用以表示网页服务器HTTP响应状态的3位数字代码。它由RFC 2616规范定义的,并得到RFC 2518,RFC 2295,RFC 2774 ,RFC 4918等规范扩展。1字头,消息这一类型的状态码,代表请求已被接受,需要继续处理、这类响应是临时响应,只包含状态行和某些可选的响应头信息,并以空行结束。由于HTTP/1.0协议中没有定义任何1XX状

2016-06-01 12:03:35 686

原创 leetcode 26. Remove Duplicates from Sorted Array

题目Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with co

2016-06-01 11:06:59 313

原创 leetcode 66. Plus One

题目Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.解public class Solution {

2016-05-31 15:30:31 313

原创 leetcode 101. Symmetric Tree

题目Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: But the following is not:解/** * Definition for a binary tre

2016-05-31 14:47:17 305

转载 java:equals与hascode( )

Java中的equals方法和hashcode方法是Object中的,所以每个对象都是有这两个方法的,有时候我们需要实现特定需求,可能要重写这两个方法。1.区别eqauls()和hashcode()方法是用来在同一类中做比较用的,尤其是在容器里如set存放同一类对象时用来判断放入的对象是否重复。这里我们首先要明白一个问题: 1,equals()相等的两个对象,hashcode()一定相等,equ

2016-05-31 14:19:04 474

原创 leetcode 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 in place with constant memory.The ord

2016-05-31 11:11:18 265

转载 leetcode 110. Balanced Binary Tree

题目Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ b

2016-05-31 10:28:43 314

SpringMVC需要的jar包

SpringMVC需要的jar包

2016-12-29

hibernate需要的jar包们

HIbernate需要的jar包,注意里面的log4j.jar,一定要加进去。

2016-12-14

构建struts2的7个jar包

解压后,将这7个jar包放入项目的/WebRoot/WEB-INF/lib下即可。

2016-12-13

空空如也

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

TA关注的人

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