集合
文章平均质量分 90
memcpy0
希望探索文理结合的自由之路。
展开
-
LeetCode 2353. 设计食物评分系统【设计,哈希表,有序集合;堆+懒删除】1781
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2024-01-07 20:36:16 · 1502 阅读 · 0 评论 -
LeetCode 1488. 避免洪水泛滥【贪心,二分,有序集合】1973
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-10-13 15:23:02 · 114 阅读 · 0 评论 -
LeetCode 2034. 股票价格波动【设计,哈希表,有序映射】1831
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-10-09 11:08:23 · 113 阅读 · 0 评论 -
LeetCode 1418. Display Table of Food Orders in a Restaurant【集合/映射/字符串】中等
Given the array orders, which represents the orders that customers have done in a restaurant. More specifically orders[i]=[customerNamei,tableNumberi,foodItemi] where customerNamei is the name of the customer, tableNumberi is the table custo原创 2021-07-12 21:33:38 · 153 阅读 · 1 评论 -
LeetCode C++ 874. Walking Robot Simulation【模拟】简单
A robot on an infinite grid starts at point (0, 0) and faces north. The robot can receive one of three possible types of commands:-2: turn left 90 degrees-1: turn right 90 degrees1 <= x <= 9: move forward x unitsSome of the grid squares are ob原创 2020-11-15 00:42:21 · 193 阅读 · 0 评论 -
LeetCode C++ 599. Minimum Index Sum of Two Lists【Hash Table】简单
Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.You need to help them find out their common interest with the least list index sum. If there is a choice tie between an原创 2020-11-11 19:34:10 · 146 阅读 · 0 评论 -
Leetcode C++ 349. Intersection of Two Arrays【Hash Table/Sort/Two Pointers/Binary Search】简单
Given two arrays, write a function to compute their intersection.Example 1:Input: nums1 = [1,2,2,1], nums2 = [2,2]Output: [2]Example 2:Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]Output: [9,4]...原创 2020-03-28 01:11:24 · 198 阅读 · 0 评论 -
【数据结构Java实现】集合【链表和二叉搜索树实现】
文章目录集合1. 集合介绍2. 基于二叉搜索树的集合实现3. 基于链表的集合实现4. 性能比较5. 复杂度分析6. 有序集合与无序集合集合和映射——是高层的数据结构,是一些接口,提供相应的API,用于不同的应用。底层的实现,则多种多样。这篇文章中,基于二叉搜索树和链表,分别实现集合类。集合1. 集合介绍这里实现的集合和数学里的集合一样,在实际应用时能够快速帮助我们去重。回忆上次实现的二分...原创 2020-03-26 15:03:40 · 323 阅读 · 0 评论 -
Leetcode C++ 804. Unique Morse Code Words 【Set】
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: “a” maps to “.-”, “b” maps to “-…”, “c” maps to “-.-.”, and so on.For conv...原创 2020-03-26 14:24:25 · 251 阅读 · 0 评论