上一页 1 2 3 4 5 6 7 ··· 44 下一页
摘要: 问题: 给定一组数,求其中最大子set,使得set中其中任意两元素之间: a%b=0 or b%a=0 Example 1: Input: nums = [1,2,3] Output: [1,2] Explanation: [1,3] is also accepted. Example 2: Inp 阅读全文
posted @ 2021-04-15 19:56 habibah_chang 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 问题: 设计数据结构,使得完成以下功能: 关注用户: void follow(int followerId, int followeeId) 取关用户: void unfollow(int followerId, int followeeId) 某用户发状态: void postTweet(int 阅读全文
posted @ 2021-04-15 17:10 habibah_chang 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 问题: 设计结构体,能够满足以下两个功能: 向结构体中插入数据 void addNum(int num) 去当前结构体中的中位数 double findMedian() 若共有奇数个数,取最中间的数 若共有偶数个数,取中间两个数之和/2 Example 1: Input ["MedianFinder 阅读全文
posted @ 2021-04-15 15:00 habibah_chang 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 相关问题:146. LRU Cache 问题: 设计类LFUCache,实现LFU Cache Least Frequently Used 优先度为:访问频率最多优先 的缓存。 缓存大小一定,capacity get(key):通过key查找value,若缓存中不存在key,返回-1 put(key 阅读全文
posted @ 2021-04-15 11:59 habibah_chang 阅读(58) 评论(0) 推荐(0) 编辑
摘要: 问题: 设计类LRUCache,实现LRU Cache Least Recently Used 优先度为:最近使用优先 的缓存。 缓存大小一定,capacity get(key):通过key查找value,若缓存中不存在key,返回-1 put(key, value):插入缓存key=value。 阅读全文
posted @ 2021-04-14 19:44 habibah_chang 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 问题: 将给定正整数n,拆成多个数。(使得这些数之和=n) 这些数之积最大是多少。 Example 1: Input: n = 2 Output: 1 Explanation: 2 = 1 + 1, 1 × 1 = 1. Example 2: Input: n = 10 Output: 36 Exp 阅读全文
posted @ 2021-04-14 13:56 habibah_chang 阅读(55) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定多个字符串定义:某个小写字母==(!=)另一个小写字母 求这些定义中,有互相矛盾的情况吗? 有矛盾,返回false,否则返回true。 Example 1: Input: ["a==b","b!=a"] Output: false Explanation: If we assign sa 阅读全文
posted @ 2021-04-13 19:37 habibah_chang 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个字符串,表示一个由+-*三种运算符组成的算式。 求给运算式任意加括号,使得计算优先顺序变化。 所得所有结果的可能。 Example 1: Input: expression = "2-1-1" Output: [0,2] Explanation: ((2-1)-1) = 0 (2-( 阅读全文
posted @ 2021-04-11 16:14 habibah_chang 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 问题: 求数组中第k大的元素。 Example 1: Input: nums = [3,2,1,5,6,4], k = 2 Output: 5 Example 2: Input: nums = [3,2,3,1,2,4,5,5,6], k = 4 Output: 4 Constraints: 1 < 阅读全文
posted @ 2021-04-11 14:36 habibah_chang 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定两个int数组,代表两个数位数值的列表。 从两个数组中,按照已有的顺序选取数位数值, 组成一个新的数,长度为k 求能构成的数最大为? Example 1: Input: nums1 = [3,4,6,5], nums2 = [9,1,2,5,8,3], k = 5 Output: [9, 阅读全文
posted @ 2021-04-09 20:17 habibah_chang 阅读(39) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 44 下一页