java
小页睡着了zZ
算法能力的提升是一个循序渐进的过程
展开
-
String.intern()详细分析,JDK1.8
前言 本文的测试环境是JDK1.8。 String.intern()分析在文中偏后一.创建字符串分析1.直接使用双引号创建字符串 判断这个常量是否存在于常量池, 如果存在, 判断这个常量是存在的引用还是常量, 如果是引用,返回引用地址指向的堆空间对象, 如果是常量,则直接返回常量池常量, 如果不存在, 在常量池中创建该常量,并返回此常量 ...原创 2018-11-01 12:19:13 · 15847 阅读 · 40 评论 -
Leetcode 1012.Complement of Base 10 Integer
题目描述Every non-negative integer N has a binary representation. For example, 5 can be represented as “101” in binary, 11 as “1011” in binary, and so on. Note that except for N = 0, there are no lead...原创 2019-03-22 10:09:21 · 137 阅读 · 0 评论 -
Leetcode 1013. Pairs of Songs With Total Durations Divisible by 60
题目描述(传送门)In a list of songs, the i-th song has a duration of time[i] seconds.Return the number of pairs of songs for which their total duration in seconds is divisible by 60. Formally, we want the...原创 2019-03-22 10:39:34 · 128 阅读 · 0 评论 -
Leetcode 1014. Capacity To Ship Packages Within D Days
题目描述(传送门)A conveyor belt has packages that must be shipped from one port to another within D days.The i-th package on the conveyor belt has a weight of weights[i]. Each day, we load the ship with ...原创 2019-03-22 15:07:36 · 147 阅读 · 0 评论 -
Leetcode 1022.Smallest Integer Divisible by K.
题目描述(传送门)Given a positive integer K, you need find the smallest positive integer N such that N is divisible by K, and N only contains the digit 1.Return the length of N. If there is no such N, ret...原创 2019-03-24 14:48:07 · 224 阅读 · 0 评论 -
Leetcode 1021. Best Sightseeing Pair.
题目描述Given an array A of positive integers, A[i] represents the value of the i-th sightseeing spot, and two sightseeing spots i and j have distance j - i between them.The score of a pair (i < j) ...原创 2019-03-24 15:53:10 · 247 阅读 · 0 评论