java
_bazinga
这个作者很懒,什么都没留下…
展开
-
集合之LinkedList
转至:https://www.cnblogs.com/ITtangtang/p/3948610.html一、源码解析 1、 LinkedList类定义。 public class LinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E&...转载 2018-06-26 10:13:33 · 181 阅读 · 0 评论 -
struts2工作流程
1.客户端发出一个HttpServletRequest请求,这个请求经过一系列的过滤器Filter(如ActionContextCleanUp等),这些过滤器最终会调用FilterDispatcher类(现在是StrutsPrepareExcuteFilter)的serviceAction方法,FilterDispatcher是控制器的核心,就是MVC的struts2实现中控制层的核心2.Fi原创 2017-08-09 19:21:29 · 238 阅读 · 0 评论 -
[leetcode] 33.Search in Rotated Sorted Array
题目:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search原创 2017-08-16 21:30:25 · 200 阅读 · 0 评论 -
[leetcode] 12. Integer to Roman
题目:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.罗马数字:罗马数字记数的方法:1.相同的数字连写,所表示的数等于这些数字相加得到的数,如 Ⅲ=3;2.小的数字在大的数字的右边,所表示的数等于原创 2017-08-09 16:21:13 · 159 阅读 · 0 评论 -
[leetcode] 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,原创 2017-08-09 15:55:45 · 161 阅读 · 0 评论 -
[leetcode] 8. String to Integer (atoi)
题目:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible原创 2017-08-09 14:52:03 · 172 阅读 · 0 评论 -
[leetcode] 50. Pow(x, n)
题目:Implement pow(x, n).题解:可以用递归来折半计算,每次把n缩小一半,这样n最终会缩小到0,任何数的0次方都为1,这时候我们再往回乘,如果此时n是偶数,直接把上次递归得到的值算个平方返回即可,如果是奇数,则还需要乘上个x的值。还有一点需要引起我们的注意的是n有可能为负数,对于n是负数的情况,我们可以先用其绝对值计算出一个结果再取其倒数即可, pub原创 2017-08-08 16:46:51 · 192 阅读 · 0 评论 -
[leetcode] 2. Add Two Numbers
题目:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and原创 2017-08-08 16:51:48 · 196 阅读 · 0 评论 -
[leetcode] 3. Longest Substring Without Repeating Characters
题目:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the an原创 2017-08-08 16:50:22 · 144 阅读 · 0 评论 -
[leetcode] 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","tan"], ["bat"]]原创 2017-08-08 16:45:01 · 184 阅读 · 0 评论 -
[leetcode] 39. Combination Sum
题目:Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may b原创 2017-08-08 16:40:20 · 210 阅读 · 0 评论 -
[leetcode] 43. Multiply Strings
题目:Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2.Note:The length of both num1 and num2 is Both num1 and num2 contains on原创 2017-08-08 16:35:16 · 152 阅读 · 0 评论 -
[leetcode]175 Second Highest Salary
Write a SQL query to get the second highest salary from the Employee table.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+--------+For examp转载 2017-07-24 14:53:25 · 218 阅读 · 0 评论 -
[leetcode] 198. House Robber
题目You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjace原创 2017-07-25 21:43:40 · 149 阅读 · 0 评论 -
[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],原创 2017-08-17 19:43:15 · 185 阅读 · 0 评论 -
[leetcode] 47. Permutations II
题目:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[ [1,1,2], [1,2,1原创 2017-08-17 20:17:27 · 207 阅读 · 0 评论 -
集合之ArrayList
package java.util;public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializable{ private static final long seria...原创 2018-06-25 20:14:06 · 197 阅读 · 0 评论 -
[leetcode] 31. Next Permutation
题目:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest原创 2017-08-15 19:41:34 · 186 阅读 · 0 评论 -
[leetcode] 103.Binary Tree Zigzag Level Order Traversal
题目:Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:Give原创 2017-08-05 15:02:23 · 175 阅读 · 0 评论 -
[leetcode] 234. Palindrome Linked List
题目:Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?题解:这道题让我们判断一个链表是否为回文链表,LeetCode中关于回文串的题共有六道,除了这道,其他的五道为Palindrome原创 2017-07-27 21:29:25 · 187 阅读 · 0 评论 -
[leetcode] 29. Divide Two Integers
题目:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.题解:这道题让我们求两数相除,而且规定我们不能用乘法,除法和取余操作,那么我们还可以用另一神器位操作Bit Operation,比如20/原创 2017-08-12 15:47:39 · 180 阅读 · 0 评论 -
[leetcode] 231. Power of Two
题目Given an integer, write a function to determine if it is a power of two.判断一个数是否是2的次方数解法一:如果一个数是2的幂,则除以2肯定能整除,最后商为1 public boolean isPowerOfTwo(int n){ if(n<=0) return false; while原创 2017-07-27 19:55:03 · 162 阅读 · 0 评论 -
[leetcode] 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:[ "((()))", "(()())", "(())()",原创 2017-08-11 19:07:36 · 178 阅读 · 0 评论 -
[leetcode] 19. Remove Nth Node From End of Lis
题目:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the原创 2017-08-11 17:17:21 · 159 阅读 · 0 评论 -
[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 w原创 2017-07-26 20:25:28 · 164 阅读 · 0 评论 -
[leetcode] 204. Count Primes
题目:Count the number of prime numbers less than a non-negative number, n.题解:这道题给定一个非负数n,让我们求小于n的质数的个数,题目中给了充足的提示,解题方法就在第二个提示埃拉托斯特尼筛法Sieve of Eratosthenes中,这个算法的过程如下图所示,我们从2开始遍历到根号n,先找到第一个质数2,原创 2017-07-26 19:52:57 · 137 阅读 · 0 评论 -
【leetcode】 17. Letter Combinations of a Phone Number
题目:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input原创 2017-08-10 18:43:32 · 235 阅读 · 0 评论 -
[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?题解:在计算机图像处理里,旋转图片是很常见的,由于图片的本质是二维数原创 2017-08-17 20:36:18 · 289 阅读 · 0 评论 -
[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.题解:给定一个整数n,返回n!(n的阶乘)数字中的后缀0的个数。注意:你的解法应该满足多项式时间复杂度原创 2017-07-24 14:41:33 · 132 阅读 · 0 评论 -
[leetcode] 258. Add Digits
题目:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2原创 2017-07-30 20:26:39 · 139 阅读 · 0 评论 -
mysql安装配置
一、mysql下载到官网下载安装版的,一定要是安装版的,之前下载两个都不是安装版的,安装的时候一直没跳到配置用户名密码那个步骤1.1进入官网的download,选择mysql installer1.2 选择要下载的文件1.3点击download二、安装mysql2.1 选择安装类型Developer Default:默认安装类型 Server原创 2017-05-22 09:58:02 · 337 阅读 · 0 评论 -
java泛型
原文地址:http://www.cnblogs.com/lwbqqyumidi/p/3837629.html一. 泛型概念的提出(为什么需要泛型)?首先,我们看下下面这段简短的代码: 1 public class GenericTest { 2 3 public static void main(String[] args) { 4 Li转载 2017-06-06 15:20:26 · 385 阅读 · 0 评论 -
request的getParameter和getAttribute
一、getParameter方法 该方法是用于客户端通过get或者post传递过来的参数,它的返回值类型永远是是字符串类型 注意,这里强调的是客户端请求时,是客户端发送给服务器的参数,这个赋值动作是有客户端完成的。没有对应的setParameter方法二、getAttribute方法 该方法用于获取request对象中的attribute值,这个值是原创 2017-06-06 09:51:44 · 399 阅读 · 0 评论 -
Java面试题(类初始化顺序总结)
原文地址:http://blog.csdn.net/sp_programmer/article/details/412782911 无继承情况下的Java初始化顺序:class Sample{ Sample(String s) { System.out.println(s); } Sample(转载 2017-06-06 08:59:25 · 500 阅读 · 0 评论 -
IntelliJ IDEA 最简单配置搭建Spring MVC Java web Maven项目
原文地址:http://blog.csdn.net/qq_27093465/article/details/68961393使用这个IntelliJ IDEA创建一个简单的Java web maven项目,我在前面的文章里面已经示范过了。先看下项目目录至于为什么这么做,看下面链接的解释:IntelliJ IDEA 中 右键新建时,选项没有Ja转载 2017-05-21 14:57:54 · 8781 阅读 · 0 评论 -
IntelliJ IDEA 创建 hello world Java web Maven项目
原文地址:http://blog.csdn.net/qq_27093465/article/details/63683873学Java的大部分吧都是要整Java web开发项目的,那么最好用的编辑器估计就是这个 IntelliJ IDEA,然后现在maven管理项目是很流行的。然后我就示范一下,如何使用这个IntelliJ IDEA 创建一个Java web 项目的hello world项转载 2017-05-21 15:04:39 · 423 阅读 · 0 评论 -
IntelliJ IDEA 快捷键
一、get 、set方法Alt+Insert二、自动导入类所在包Alt+Enter原创 2017-05-21 14:54:38 · 575 阅读 · 0 评论 -
tomcat提示:指定的服务未安装
1.启动tomcatw.exe时出现以下问题2.解决办法:打开命令行提示符窗口=> 进入Tomcat安装目录==> 进入bin目录下==> 输入:service.bat install 即可原创 2017-05-21 09:58:06 · 349 阅读 · 0 评论 -
springmvc+json
一、在maven文件添加json依赖的包 com.fasterxml.jackson.core jackson-core 2.7.4 com.fasterxml.jackson.core jackson-annotations 2.7.4 com.fasterxm原创 2017-06-04 19:26:00 · 181 阅读 · 0 评论 -
springmvc 后台接收前台数据
1,使用HttpServletRequest获取1.1后台方法 @RequestMapping(value="/login",method = RequestMethod.POST) public String login(HttpServletRequest request) { if(userService.selectUser(request.getPa原创 2017-05-25 16:36:52 · 595 阅读 · 0 评论