leetcode554. Brick Wall

2020-01-26
阅读 2 分钟
2.4k
There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. You want to draw a vertical line from the top to the bottom and cross the least bricks.

leetcode525. Contiguous Array

2020-01-18
阅读 2 分钟
2.2k
Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.

leetcode454. 4Sum II

2019-10-23
阅读 2 分钟
1.5k
采用一些归并排序的思路,假如我们将A,B中所有数字排列组合能够构成的结果计算出来,再将C,D中所有数字的排列组合结果计算出来,则只需要针对AB中的值找到CD中是否有对应的负数存在即可。这里除了要记录数组元素的和,还要记录该求和出现了几次。代码如下:

猫头鹰的深夜翻译:Java WeakHashMap

2018-12-07
阅读 3 分钟
2.2k
本文简介 WeakHashMap类概览 WeakHashMap类构造器总结 WeakHashMap类构造方法 WeakHasjMap类使用举例 1. WeakHashMap类概览 WeakHashMap是一个实现了Map接口,并且键为weak型的哈希表。WeakHashMap中的条目不再被正常使用时,会被自动删除。它的键值均支持null。这个类类似于HashMap类,也具有初始容量和负载因子这样的...

leetcode299. Bulls and Cows

2018-03-05
阅读 2 分钟
3k
Bulls and Cows游戏简单来说就是你随手写下一个n位数,并让你同学猜这个数字是什么。假设你的朋友也会猜测一个n位数,他每猜一个数字,你就需要告诉他,猜测的数字中位置正确且值正确的数字(bulls)有几个,位置不正确但是值不正确的数字(cows)有几个。