上一页 1 2 3 4 5 6 7 8 ··· 44 下一页
摘要: 问题: 给定n个初始状态为off的灯, 第1次,按 1*i 号灯的开关。 第2次,按 2*i 号灯的开关。 ... 第n次,按 n 号灯的开关。 求最后on的灯共有几个。 Example 1: Input: n = 3 Output: 1 Explanation: At first, the thr 阅读全文
posted @ 2021-04-09 13:18 habibah_chang 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 问题: 给n个石子,由你开始选取,和你的朋友轮流进行。 每次选取,可以选取1~3个石子, 最后一个取完石子的人获胜,返回你是否能赢得胜利。 Example 1: Input: n = 4 Output: false Explanation: These are the possible outcom 阅读全文
posted @ 2021-04-09 12:35 habibah_chang 阅读(39) 评论(0) 推荐(0) 编辑
摘要: 问题: 求0~num 每个数的二进制中含有 1 的个数。 Example 1: Input: num = 2 Output: [0,1,1] Explanation: 0 --> 0 1 --> 1 2 --> 10 Example 2: Input: num = 5 Output: [0,1,1, 阅读全文
posted @ 2021-04-07 15:48 habibah_chang 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 问题: 去除有序链表中重复的节点。 Example 1: Input: head = [1,1,2] Output: [1,2] Example 2: Input: head = [1,1,2,3,3] Output: [1,2,3] Constraints: The number of nodes 阅读全文
posted @ 2021-04-07 14:49 habibah_chang 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 问题: 将数组中的0移到末尾。 Example 1: Input: nums = [0,1,0,3,12] Output: [1,3,12,0,0] Example 2: Input: nums = [0] Output: [0] Constraints: 1 <= nums.length <= 1 阅读全文
posted @ 2021-04-07 14:39 habibah_chang 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 问题: 删除数组中的元素val。 返回剩下数组的size。 Example 1: Input: nums = [3,2,2,3], val = 3 Output: 2, nums = [2,2] Explanation: Your function should return length = 2, 阅读全文
posted @ 2021-04-07 14:17 habibah_chang 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 问题: 去除有序数组中重复的数字。 Example 1: Input: nums = [1,1,2] Output: 2, nums = [1,2] Explanation: Your function should return length = 2, with the first two ele 阅读全文
posted @ 2021-04-07 13:59 habibah_chang 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个二维数组, 求给定区间围成矩形的和。 Example 1: Input ["NumMatrix", "sumRegion", "sumRegion", "sumRegion"] [[[[3, 0, 1, 4, 2], [5, 6, 3, 2, 1], [1, 2, 0, 1, 5], 阅读全文
posted @ 2021-04-06 15:17 habibah_chang 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 类似问题: 382. Linked List Random Node 问题: 给定一组数(可能有重复的数字), 求随机取得数字=target的index。 ⚠️ 注意:取得每个数的概率要相同。 Example 1: Input ["Solution", "pick", "pick", "pick"] 阅读全文
posted @ 2021-04-06 14:36 habibah_chang 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个链表,求随机抽取一个元素。 使得每个元素被取出的概率相同。 Example 1: Input ["Solution", "getRandom", "getRandom", "getRandom", "getRandom", "getRandom"] [[[1, 2, 3]], [], 阅读全文
posted @ 2021-04-06 14:02 habibah_chang 阅读(38) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 44 下一页