![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
array
KiKi来了
这个作者很懒,什么都没留下…
展开
-
169.多数元素
示例1:3/2=1其中3出现2次,大于1,所以输出3.方法1:HashMapclass Solution { public int majorityElement(int[] nums) { //出现次数 nums.length/2 //计算每个元素的出现次数,用HashMap HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); .原创 2020-12-01 16:02:04 · 61 阅读 · 0 评论 -
[LeetcodeHot100Likes]1. Two Sum
超时:class Solution { public int[] twoSum(int[] nums, int target) { int[] num = new int[2]; for (int i = 0; i < nums.length; i++) { for(int j = i + 1; j < nums.length; j++) { if (nums[j] == target - n..原创 2020-11-14 10:54:11 · 79 阅读 · 0 评论 -
Flood fill algorithm
Flood fill算法是从一个区域中提取若干个连通的点与其他相邻区域区分开的经典算法。因为其思路类似洪水从一个区域扩散到所有能到达的区域而得名。在GNU Go和扫雷中,Flood Fill算法被用来计算需要被清除的区域。https://www.educative.io/edpresso/what-is-the-flood-fill-algorithmThe flood fill algorithm is used to determine the properties of the area arou原创 2020-10-21 09:30:36 · 195 阅读 · 0 评论