自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(9)
  • 收藏
  • 关注

原创 test

2021-03-21 12:42:30 70

原创 1625. Lexicographically Smallest String After Applying Operations

问题: 给定一个由0~9构成的字符串s 对其有两种操作: 偶数位置+a(超过9,则从0开始循环) 例:ifs = "3456"anda = 5,sbecomes"3951". 字符串向后移动 b位(后面的字符循环到字符串前部) 例:ifs = "3456"andb = 1,sbecomes"6345". 求进行多次操作后,能获得的数值最小的字符串是什么。 Example 1: Input: s = "5525", a = 9, b = 2 Output: "2...

2021-03-20 15:01:22 111

原创 1519. Number of Nodes in the Sub-Tree With the Same Label

问题: 给定一棵以0为root的树, 给定 该树的节点连接关系。 每个节点上标记的字母。 求以各个节点为root的子树中,拥有和该节点标记字母相同节点的个数。 Example 1: Input: n = 7, edges = [[0,1],[0,2],[1,4],[1,5],[2,3],[2,6]], labels = "abaedcd" Output: [2,1,1,1,1,1,1] Explanation: Node 0 has label 'a' and its sub-tree has

2021-03-20 14:32:50 127

原创 1391. Check if There is a Valid Path in a Grid

问题: 给定一个n*m数组,代表公路。 1:连接 left + right 2:连接 up + down 3:连接 left + down 4:连接 right + down 5:连接 left + up 6:连接 right + up 求是否能够从左上角格子(0,0)到达,右下角(n-1,m-1)。 Example 1: Input: grid = [[2,4,3],[6,5,2]] Output: true Explanation: As shown you can start a

2021-03-20 13:25:17 93

原创 1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree

问题: 给定两棵二叉树。 原二叉树original 拷贝二叉树cloned 以及原二叉树上的节点target 求拷贝二叉树上同一个位置的节点。 Example 1: Input: tree = [7,4,3,null,null,6,19], target = 3 Output: 3 Explanation: In all examples the original and cloned trees are shown. The target node is a green node fro

2021-03-19 15:11:23 77

原创 1319. Number of Operations to Make Network Connected

问题: 给定n个节点,和节点之间的连线关系connections。 若其中有多余的连线,可用于连接任意不相连的节点,使得所有节点相连。 求若可以,至少需要多少条连线。 不可以,返回-1。 Example 1: Input: n = 4, connections = [[0,1],[0,2],[1,2]] Output: 1 Explanation: Remove cable between computer 1 and 2 and place between computers 1 and 3.

2021-03-19 14:52:19 93

原创 1311. Get Watched Videos by Your Friends

问题: 朋友看视频问题。 给定一个朋友关系网, friends[i]表示 i 的朋友们。 watchedVideos[i]表示 i 所看的视频。 level表示朋友层,1:代表i的朋友,2:代表i的朋友的朋友。 求给定人 i 的朋友层level,所看过的所有视频。(按照视频被看的人数从少到多排序) Example 1: Input: watchedVideos = [["A","B"],["C"],["B","C"],["D"]], friends = [[1,2],[0,3],[0,3],

2021-03-19 11:16:32 402

原创 993. Cousins in Binary Tree

问题: 求给定二叉树中,x节点和y节点是否为表兄弟关系。 表兄弟关系为:在同一层&&父节点不同。 Example 1: Input: root = [1,2,3,4], x = 4, y = 3 Output: false Example 2: Input: root = [1,2,3,null,4,null,5], x = 5, y = 4 Output: true Example 3: Input: root = [1,2,3,null,4], x = 2, y = 3 Ou

2021-03-18 17:36:31 87

原创 1306. Jump Game III

问题: 跳棋问题。 给定跳棋一维数组arr arr[i]代表到达位置 i 后,能够向前or向后移动的步数 即,下一个位置为:i+arr[i] or i-arr[i] ⚠️ 注意:这里下个位置不能超出arr范围。 求从给定Start位置开始,是否能最终走到arr[x]==0的位置。 Example 1: Input: arr = [4,2,3,0,3,1,2], start = 5 Output: true Explanation: All possible ways to reach at

2021-03-18 13:57:23 68

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除