xinyu04

导航

上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 30 下一页

2022年7月30日 #

LeetCode 238 Product of Array Except Self 前缀积&后缀积

摘要: Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i]. The produc 阅读全文

posted @ 2022-07-30 20:09 Blackzxy 阅读(12) 评论(0) 推荐(0) 编辑

LeetCode 82 Remove Duplicates from Sorted List II 链表删除重复元素

摘要: Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Return the 阅读全文

posted @ 2022-07-30 17:11 Blackzxy 阅读(5) 评论(0) 推荐(0) 编辑

MathProblem 12 Three men, a bell boy, and a motel room problem

摘要: Three men walk into a motel and ask for a room. The desk clerk says a room is 30 so each man pays 10 towards the cost. Later, the clerk realizes he ma 阅读全文

posted @ 2022-07-30 05:34 Blackzxy 阅读(20) 评论(0) 推荐(0) 编辑

MathProblem 9 Chicken McNugget problem

摘要: At McDonalds you can order Chicken McNuggets in boxes of $6$, $9$, and $20$. What is the largest number such that you can not order any combination of 阅读全文

posted @ 2022-07-30 05:04 Blackzxy 阅读(45) 评论(0) 推荐(0) 编辑

LeetCode 152 Maximum Product Subarray 思维

摘要: Given an integer array nums, find a contiguous non-empty subarray within the array that has the largest product, and return the product. The test case 阅读全文

posted @ 2022-07-30 03:09 Blackzxy 阅读(15) 评论(0) 推荐(0) 编辑

2022年7月29日 #

LeetCode 204 Count Primes 欧拉(素数)筛

摘要: Given an integer $n$, return the number of prime numbers that are strictly less than $n$. Solution 统计小于 $n$ 的素数个数。这里用欧拉筛来筛素数,$is_prime$ 用来记录该数是否为素数,$p 阅读全文

posted @ 2022-07-29 19:23 Blackzxy 阅读(22) 评论(0) 推荐(0) 编辑

LeetCode 162 Find Peak Element 二分

摘要: A peak element is an element that is strictly greater than its neighbors. Given a $0$-indexed integer array nums, find a peak element, and return its 阅读全文

posted @ 2022-07-29 18:49 Blackzxy 阅读(14) 评论(0) 推荐(0) 编辑

LeetCode 153 Find Minimum in Rotated Sorted Array 二分

摘要: Suppose an array of length $n$ sorted in ascending order is rotated between $1$ and $n$ times. For example, the array nums = [0,1,2,4,5,6,7] might bec 阅读全文

posted @ 2022-07-29 17:05 Blackzxy 阅读(8) 评论(0) 推荐(0) 编辑

LeetCode 108 Convert Sorted Array to Binary Search Tree DFS

摘要: Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree. A height-balanced bi 阅读全文

posted @ 2022-07-29 05:59 Blackzxy 阅读(11) 评论(0) 推荐(0) 编辑

LeetCode 74 Search a 2D Matrix 二分

摘要: Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties: Integers in 阅读全文

posted @ 2022-07-29 02:10 Blackzxy 阅读(8) 评论(0) 推荐(0) 编辑

上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 30 下一页