![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
哈希
难过的风景
君子慎独 不欺暗室
展开
-
LeetCode.525 连续数组
原题 https://leetcode-cn.com/problems/contiguous-array/ 思路 1不变,把0变成-1,求和为0 的最大长度 前缀和 + hash 题解 package com.leetcode.code; import java.util.HashMap; import java.util.Map; /** * @Description: * @ClassName: Code525 * @Author: ZK * @Date: 2021/6/3 15:00原创 2021-06-03 15:38:34 · 83 阅读 · 2 评论 -
LeetCode.692 前K个高频单词
原题 https://leetcode-cn.com/problems/top-k-frequent-words/ 思路 先哈希 再排序,排序代码是经典(值得一看) 题解 class Solution { public List<String> topKFrequent(String[] words, int k) { Map<String, Integer> map = new HashMap<>(); for (Strin原创 2021-05-20 12:20:30 · 81 阅读 · 4 评论 -
LeetCode.554 砖墙
原题 https://leetcode-cn.com/problems/brick-wall/ 思路 题解原创 2021-05-02 23:58:56 · 89 阅读 · 2 评论