自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

chaoqunwangzi

不成功,便成神!

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

原创 虚拟机垃圾回收相关知识整理(JVM GC)

Java内存区域介绍Java内存区域有如下几部分构成1、程序计数器:指示的是当前正在执行的机器指令的地址。2、本地方法栈:通过JNI调用本地方法时根据语言的类型建立相应的栈。3、Java栈Java栈是每个线程私有的,每个线程都有一个Java栈,栈中存放着一系列的栈帧(Stack Frame),JVM只能压入(push)和弹出(pop)栈帧这两

2017-08-15 17:03:05 351

原创 遍历Map的四种方法

public static void main(String[] args) {  Map map = new HashMap();  map.put("1", "value1");  map.put("2", "value2");  map.put("3", "value3");    //第一种:普遍使用,二次取值  System.out.println("通过

2017-08-27 22:18:14 248

原创 牛客网笔试输入的问题(Java)

今天在做滴滴出行内推笔试的编程题碰到了这个问题耽误了很长时间,然而网上也没有答案,因此记录下来,方便自己查阅复习,也方便需要的小伙伴!代码如下-----滴滴2018内推的编程题:package 内推笔试;import java.util.Arrays;import java.util.Scanner;/** * Created by liuming on 2017/8/26.

2017-08-26 17:49:27 18748

原创 Longest Substring Without Repeating Characters leetcode java

题目:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is

2017-08-24 22:58:57 183

原创 Length of Last Word leetocde java

题目:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A wo

2017-08-24 22:52:28 152

原创 Jump Game II leetcode java

题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your

2017-08-24 22:15:33 212

原创 Jump Game leetcode java

题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Dete

2017-08-24 21:58:17 176

原创 Longest Common Prefix leetcode java

题目:Write a function to find the longest common prefix string amongst an array of strings. 题解:解题思路是,先对整个String数组预处理一下,求一个最小长度(最长前缀肯定不能大于最小长度)。然后以第0个字符串作为参照,从第1个字符串到最后一个字符串,对同一位置做判断,

2017-08-24 16:01:05 178

原创 Java基础部分(一)

1、一个".java"源文件中是否可以包括多个类(不是内部类)?有什么限制?   可以有多个类,但只能有一个public的类,并且public的类名必须与文件名相一致。2、Java有没有goto?   java中的保留字,现在没有在java中使用。3、说说&和&&的区别。   &和&&都可以用作逻辑与的运算符,表示逻辑与(and),当运算符两边的表达式的结果

2017-08-23 22:24:42 151

原创 IntelliJ 快捷输出方式

今天偶然发现了IntelliJ中 创建main函数的快捷键,依次还有for循环,System.out.println();在编写代码的时候直接输入psv就会看到一个psvm的提示,此时点击tab键一个main方法就写好了。psvm 也就是public static void main的首字母。依次还有在方法体内键入for会有一个fori的提示,选中然后tab键,就会

2017-08-23 12:03:57 4540

原创 Java中的equals和==总结

Java中的equals和==

2017-08-22 10:38:28 193

原创 Combinations

原题  Given two integers n and k, return all possible combinations of k numbers out of 1 … n.   For example,   If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3],

2017-08-21 21:56:51 135

原创 Sort Colors leetcode java

原题  Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.   Here, we will use the

2017-08-21 21:22:57 169

原创 Container With Most Water leetcode java

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

2017-08-21 20:10:59 194

原创 Divide Two Integers leetcode java

题目:Divide two integers without using multiplication, division and mod operator.public int divide(int dividend, int divisor) { if (dividend == 0 || divisor == 0) { return

2017-08-21 19:20:13 222

原创 N-Queens leetcode java

题目:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens

2017-08-21 18:51:30 177

原创 什么是二维数组

1、二维数组如何定义Java语言中,多维数组被看作数组的数组。 定义方式和一维数组类似,如下:type arrayName[ ][ ]; type [ ][ ]arrayName;12122、二维数组如何初始化二维数组初始化和一维数组一样,分为静态初始化和动态初始化静态初始化 Java语言中,由于把二维数组看作是数组的数组,数组空间不是连续分配的,所

2017-08-21 15:50:03 3912

原创 _XmnXmsXmxXss有什么区别

Reference:http://blog.csdn.net/ooppookid/article/details/515309321、XmnXmsXmxXss有什么区别首先,Xmn、Xms、Xmx、Xss都是JVM对内存的配置参数,我们可以根据不同需要区修改这些参数,以达到运行程序的最好效果。了解jvm内存管理看这里:jvm是如何管理内存的Xms、Xmx-X

2017-08-21 15:16:48 542

原创 进程间通信方式

管道(pipe)及有名管道(named pipe):管道可用于具有亲缘关系进程间的通信,有名管道除了具有管道所具有的功能外,它还允许无亲缘关系进程间的通信。信号(signal):信号是在软件层次上对中断机制的一种模拟,它是比较复杂的通信方式,用于通知进程有某事件发生,一个进程收到一个信号与处理器收到一个中断请求效果上可以说是一致得。消息队列(message queue):消息队

2017-08-20 22:05:26 142

原创 SpringMVC 的工作原理和机制

第一步:发起请求到前端控制器(DispatcherServlet)第二步:前端控制器请求HandlerMapping查找 Handler 可以根据xml配置、注解进行查找第三步:处理器映射器HandlerMapping向前端控制器返回Handler第四步:前端控制器调用处理器适配器去执行Handler第五步:处理器适配器去执行Handler第六步:Handler执行完成给适配器

2017-08-20 21:58:14 1014

原创 Single Number II leetcode java

题目:Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it with

2017-08-20 20:09:31 128

原创 Single Number leetcode java

题目:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without us

2017-08-20 20:02:03 139

原创 Java——HashSet和TreeSet的区别

HashSetHashSet有以下特点 不能保证元素的排列顺序,顺序有可能发生变化 不是同步的 集合元素可以是null,但只能放入一个null当向HashSet集合中存入一个元素时,HashSet会调用该对象的hashCode()方法来得到该对象的hashCode值,然后根据 hashCode值来决定该对象在HashSet中存储位置。简单的说,HashSet集合判断两

2017-08-20 19:57:14 217

原创 Longest Consecutive Sequence leetcode java

题目:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [

2017-08-20 19:44:20 135

原创 Surrounded Regions leetcode java

题目:Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X X XX O

2017-08-20 19:26:24 143

原创 Evaluate Reverse Polish Notation leetcode java

题目:Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2",

2017-08-20 19:14:55 141

原创 Simplify Path leetcode java

题目:Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c" Corner Cases:Did you consider the

2017-08-20 18:44:42 160

原创 Longest Valid Parentheses leetcode java

题目:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()

2017-08-19 20:05:51 161

原创 Maximal Rectangle leetcode java

题目:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. 题解: 这道题可以应用之前解过的Largetst Rectangle in Histogram一题辅助解决。解决方法是:

2017-08-18 20:18:55 165

原创 Largest Rectangle in Histogram leetcode java

题目:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where

2017-08-18 18:29:20 227

原创 Sort List leetcode java

题目: Sort a linked list in O(n log n) time using constant space complexity. 题解:考虑到要求用O(nlogn)的时间复杂度和constant space complexity来sort list,自然而然想到了merge sort方法。同时我们还已经做过了merge k sorted list

2017-08-17 21:10:28 147

原创 Reorder List leetcode java

题目:Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder

2017-08-17 20:25:33 153

原创 Faster\Slower 快慢指针的应用

leetcode很多题目都是利用快慢指针来解决题目,下面具体讲解下快慢指针。 概念: 快指针在每一步走的步长要比慢指针一步走的步长要多。快指针通常的步速是慢指针的2倍。在循环中的指针移动通常为:faster = faster.next.next, slower = slower.next. 应用:1. 用来找中点或中位数2. 用来判断链表

2017-08-17 20:22:28 255

原创 Merge k Sorted Lists leetcode java

题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 题解:Merge k sorted linked list就是merge 2 sorted linked list的变形题。而且我们很自然的就想到了经典的M

2017-08-17 20:05:20 110

原创 Reverse Nodes in k-Group leetcode java

题目:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain a

2017-08-17 19:52:35 177

原创 Add Two Numbers leetcode java

题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as

2017-08-17 19:43:51 122

原创 Spring官网下载dist.zip的几种方法

Reference:http://www.cnblogs.com/yjmyzz/p/3847364.htmlSpring官网改版后,很多项目的完整zip包下载链接已经隐掉了,虽然Spring旨在引导大家用更“高大上”的maven方式来管理所依赖的jar包,但是完全没想到中国的国情,在伟大的墙内,直接通过maven下载墙外的东西,要么龟速,要么直接被和谐。下面是从网上搜集的一些方

2017-08-17 11:59:24 170

原创 Copy List with Random Pointer leetcode java

题目: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list. 题解:如果要cop

2017-08-16 22:11:05 134

原创 Rotate List leetcode java

题目: Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL. 题解:这道题主要先理解题

2017-08-16 21:46:11 134

原创 Flatten Binary Tree to Linked List leetcode java

题目: Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like:

2017-08-15 20:47:44 205

空空如也

空空如也

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

TA关注的人

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