xinyu04

导航

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

2022年7月28日 #

LeetCode 33 Search in Rotated Sorted Array 二分

摘要: There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at a 阅读全文

posted @ 2022-07-28 22:20 Blackzxy 阅读(20) 评论(0) 推荐(0) 编辑

LeetCode 34 Find First and Last Position of Element in Sorted Array lower_bound & upper_bound

摘要: Given an array of integers `nums` sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not foun 阅读全文

posted @ 2022-07-28 16:26 Blackzxy 阅读(10) 评论(0) 推荐(0) 编辑

LeetCode 190 Reverse Bits [classic] 思维

摘要: Reverse bits of a given 32 bits unsigned integer. Input: n = 11111111111111111111111111111101 Output: 3221225471 (10111111111111111111111111111111) Ex 阅读全文

posted @ 2022-07-28 15:00 Blackzxy 阅读(9) 评论(0) 推荐(0) 编辑

LeetCode 103 Binary Tree Zigzag Level Order Traversal 双端队列 Deque

摘要: Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to right, then right to left for the n 阅读全文

posted @ 2022-07-28 04:26 Blackzxy 阅读(13) 评论(0) 推荐(0) 编辑

2022年7月27日 #

LeetCode 101 Symmetric Tree DFS

摘要: Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). Solution 判断树是否为对称的。我们可以直接对左右子树进行 $DFS$ 递归 阅读全文

posted @ 2022-07-27 20:10 Blackzxy 阅读(17) 评论(0) 推荐(0) 编辑

LeetCode 22 Generate Parentheses DFS

摘要: Given $n$ pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Input: n = 3 Output: ["((()))","(()())","(() 阅读全文

posted @ 2022-07-27 17:03 Blackzxy 阅读(12) 评论(0) 推荐(0) 编辑

Codeforces Round #799 (Div. 4) B E F G题解

摘要: 1. B problem B 每次删除两个元素,问最后可以保留的最大的序列长度:满足序列中每个元素都不相同。 思路: 用 $map$ 来统计一下数字出现的次数。我们接着记录奇数次数以及偶数次数的个数,次数为奇数的显然可以全部保留,对于偶数的 $-1$ 点击查看代码 #include<iostream 阅读全文

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

2022年7月26日 #

LeetCode 149 Max Points on a Line 思维

摘要: Given an array of points where points[i] = [xi, yi] represents a point on the $X-Y$ plane, return the maximum number of points that lie on the same st 阅读全文

posted @ 2022-07-26 03:55 Blackzxy 阅读(16) 评论(0) 推荐(0) 编辑

2022年7月25日 #

LeetCode 784 Letter Case Permutation DFS

摘要: Given a string s, you can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible str 阅读全文

posted @ 2022-07-25 17:18 Blackzxy 阅读(16) 评论(0) 推荐(0) 编辑

LeetCode 46 Permutations 回溯

摘要: Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. Solution 我们需要求出一个数组的全排列。那么还是依旧 阅读全文

posted @ 2022-07-25 15:47 Blackzxy 阅读(12) 评论(0) 推荐(0) 编辑

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