自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(23)
  • 收藏
  • 关注

原创 【跟Leon一起刷LeetCode】463. Island Perimeter

Island PerimeterDescription:You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diag

2018-01-20 17:35:16 153

原创 【跟Leon一起刷LeetCode】566. Reshape the Matrix

Reshape the MatrixDescription:In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its original data.You’re given a

2018-01-20 17:14:35 125

原创 【跟Leon一起刷LeetCode】669. Trim a Binary Search Tree

Trim a Binary Search TreeDescription:Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might need to

2018-01-20 16:59:28 174

原创 【跟Leon一起刷LeetCode】412. Fizz Buzz

Fizz BuzzDescription:Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples

2018-01-20 16:45:22 145

原创 【跟Leon一起刷LeetCode】620. Not Boring Movies

Not Boring MoviesDescription:X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a poster indicating the movies’ ratings and descriptions. Please wr

2018-01-20 16:37:27 251

原创 【跟Leon一起刷LeetCode】500. Keyboard Row

Keyboard RowDescription:Given a List of words, return the words that can be typed using letters of alphabet on only one row’s of American keyboard like the image below. Example 1:Input:

2018-01-20 16:25:53 147

原创 【跟Leon一起刷LeetCode】344. Reverse String

Reverse StringDescription:Write a function that takes a string as input and returns the string reversed.Example 1:Given s = "hello", return "olleh".问题描述:如题,反转一个字符串中每个字符串的顺序。Sol

2018-01-20 16:15:52 118

原创 【跟Leon一起刷LeetCode】557. Reverse Words in a String III

Reverse Words in a String IIIDescription:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Examp

2018-01-20 16:10:40 193

原创 【跟Leon一起刷LeetCode】476. Number Complement

Number ComplementDescription:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Example 1:Input: 5Output: 2Explanation: T

2018-01-19 16:02:12 130

原创 【跟Leon一起刷LeetCode】561. Array Partition I

Array Partition IDescription:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all

2018-01-16 17:32:50 126

原创 【跟Leon一起刷LeetCode】627. Swap Salary

Swap SalaryDescription:Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa) with a single upd

2018-01-16 17:18:57 272

转载 偏向锁,轻量级锁与重量级锁

偏向锁Hotspot 的作者经过以往的研究发现大多数情况下锁不仅不存在多线程竞争,而且总是由同一线程多次获得,为了让线程获得锁的代价更低而引入了偏向锁。当一个线程访问同步块并获取锁时,会在对象头和栈帧中的锁记录里存储锁偏向的线程 ID。以后该线程在进入和退出同步块时不需要花费CAS操作来加锁和解锁,而只需简单的检验一下对象头的Mark Word里是否存储着指向当前线程的偏向锁,如果存在,表示线

2018-01-16 16:29:36 257

原创 乐观锁和悲观锁

乐观并发控制(又名乐观锁)乐观并发控制(OCC = Optimistic concurrency control)是一种并发控制方法,适用于像关系型数据库以及软件事务性内存这样的事务性系统。OCC假设多个事务可以频繁地完成,而这些事务互相不会干扰。在运行时,事务使用数据源而不需要获取这些资源上的锁。在提交数据更新之前,每个事务会先检查在该事务读取数据后,有没有其他事务又修改了该数据。如果有其他

2018-01-16 16:03:18 140

原创 【跟Leon一起刷LeetCode】728. Self Dividing Numbers

Self Dividing NumbersDescription:A self-dividing number is a number that is divisible by every digit it contains.For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, an

2018-01-16 11:22:58 130

原创 【跟Leon一起刷LeetCode】617. Merge Two Binary Trees

Merge Two Binary TreesDescription:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You nee

2018-01-16 10:27:38 130

原创 【跟Leon一起刷LeetCode】657. Judge Route Circle

Judge Route CircleDescription:Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place.T

2018-01-16 10:12:29 174

原创 【跟Leon一起刷LeetCode】461. Hamming Distance

Hamming DistanceDescription:The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integersx and y, calculate the Hamming

2018-01-16 09:56:37 147

原创 【跟Leon一起刷LeetCode】595. Big Countries

Big CountriesDescription:There is a table World+-----------------+------------+------------+--------------+---------------+| name | continent | area | population | gdp

2018-01-16 09:37:11 191

原创 ReentrantLock可重入锁

Lockjava.util.concurrent.lock 中的 Lock 框架是锁定的一个抽象,它允许把锁定的实现作为 Java 类,而不是作为语言的特性来实现。这就为 Lock 的多种实现留下了空间,各种实现可能有不同的调度算法、性能特性或者锁定语义。 ReentrantLock是什么?ReentrantLock 类实现了 Lock ,它拥有与 synchronized 相同的并发性和内存语义,

2017-11-06 22:01:20 201

原创 关于Java

JDKJava程序设计语言 + Java虚拟机 + Java API类库 = JDKJREJAVA SE API子集 + Java虚拟机 = JREJava技术体系Java Card: 支持一些Java小程序(Applets)运行在小内存设备(如智能卡)上的平台。Java ME(Micro Edition): 支持Java程序运行在移动终端(手机、PDA)上的平台。以前称为J2ME。Java

2017-10-09 11:29:14 319

原创 JVM内存区域

运行时区域程序计数器程序计数器是一块比较小的内存空间,它可以看作是当前线程所执行的字节码的行号指示器。在虚拟机的概念模型里,字节码解释器工作时就是通过改变这个计数器的值来选取下一条需要执行的字节码指令,分支、循环、跳转、异常处理等基础功能需要依赖这个计数器完成。Java虚拟机在任一确定的时刻,一个处理器都只会执行一条线程中的指令。因此,为了线程切换后能恢复到正确的执行位置,每条线程都需要有一个独立的

2017-10-09 11:26:59 134

原创 Java对象的创建、访问和定位

1.对象的创建虚拟机创建一个Java对象大致的流程如下: 1.1类加载检查当虚拟机遇到一条new指令的时候,首先要去检查这个指令的参数是否能够在常量池中定位到一个类的符号引用,并且检查这个符号引用代表的类是否已经被加载、解析和初始化过。1.2给对象分配内存对象所需内存大小在类加载完成后便可确定。如果Java堆中的内存是规整的,就只需要把指针向空闲空间那边挪动一段于对象大小相等的距离。这种分配方式称

2017-10-09 11:26:06 334

原创 Spring Boot搭建spring+springMVC+Mybatis简单Demo

Spring Boot搭建spring+springMVC+Mybatis简单Demo

2017-05-04 00:05:34 691 1

空空如也

空空如也

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

TA关注的人

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