摘要: Given the root node of a binary search tree, return the sum of values of all nodes with a value in the range [low, high]. Example 1: Input: root = [10 阅读全文
posted @ 2020-11-16 04:27 Sheanne 阅读(68) 评论(0) 推荐(0)
摘要: 112 Path Sum 和113 Path Sum2 关注的是从root到leaf的情况,437 Path Sum3 关注的是任一点 downwards到某一个点的情况。 三题感觉都是比较典型的dfs题。 112 # Definition for a binary tree node. # cla 阅读全文
posted @ 2020-11-15 10:27 Sheanne 阅读(82) 评论(0) 推荐(0)
摘要: Given an n-ary tree, return the level order traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversa 阅读全文
posted @ 2020-11-09 10:14 Sheanne 阅读(51) 评论(0) 推荐(0)
摘要: Given a string s, return the maximum number of ocurrences of any substring under the following rules: The number of unique characters in the substring 阅读全文
posted @ 2020-11-09 09:58 Sheanne 阅读(140) 评论(0) 推荐(0)
摘要: Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true方法:先把linked 阅读全文
posted @ 2020-11-09 09:23 Sheanne 阅读(63) 评论(0) 推荐(0)
摘要: Given the root of a binary tree, return the sum of every tree node's tilt. The tilt of a tree node is the absolute difference between the sum of all l 阅读全文
posted @ 2020-11-09 01:46 Sheanne 阅读(128) 评论(0) 推荐(0)
摘要: Given an array of integers arr. Return the number of sub-arrays with odd sum. As the answer may grow large, the answer must be computed modulo 10^9 + 阅读全文
posted @ 2020-11-08 07:38 Sheanne 阅读(91) 评论(0) 推荐(0)
摘要: Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of sto 阅读全文
posted @ 2020-11-08 07:03 Sheanne 阅读(73) 评论(0) 推荐(0)
摘要: You have n candies, the ith candy is of type candies[i]. You want to distribute the candies equally between a sister and a brother so that each of the 阅读全文
posted @ 2020-11-08 04:50 Sheanne 阅读(56) 评论(0) 推荐(0)
摘要: You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai 阅读全文
posted @ 2020-11-08 04:32 Sheanne 阅读(59) 评论(0) 推荐(0)