Java API一些注意的零碎不定期整理

Arrays.binarySearch() 二分搜索是建立在有序数组上的，所以搜索前排序，否则得到的结果不可行。 指定from, to的时候，包括from，不包括to 如果查找到返回对应的位置，没有查找到返回第一个比他大的位置，值为负数，转换后为(-res -1） 不管指定区间与否，3都成立。 将集合元素反序Collections.reverse()运行时间在线性范围，但是需要开辟额外的空间。...

leetcode 91. Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total number of w...

leetcode 523. Continuous Subarray Sum

Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multiple of k, that is, sums up to n...

leetcode 322. Coin Change

You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money c...

leetcode 221. Maximal Square & 85. Maximal Rectangle

221. Maximal SquareGiven a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.For example, given the following matrix:1 0 1 0 0 1 0 1 1 1 1 1 1 1...

leetcode 139. Word Break

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. You may assum...

leetcode 63. Unique Paths II

Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the grid.For ex...

leetcode 264. Ugly Number II

Total Accepted: 56978 Total Submissions: 176871 Difficulty: Medium Contributor: LeetCode Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include...

leetcode 120. Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle [ [2], [3,4], [6,5,7],...

leetcode 213. House Robber II

Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all...

leetcode 376. Wiggle Subsequence

A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either posi...

89条 共6页1 2 3 4 5 ... 下一页 尾页
个人资料
• 访问：44148次
• 积分：1263
• 等级：
• 排名：千里之外
• 原创：86篇
• 转载：3篇
• 译文：0篇
• 评论：5条
阅读排行
博客专栏
 Scala进阶源码实战 文章：8篇 阅读：4280
最新评论