题目大意:给定一个 N 个点的序列,求有多少个区间满足\(\oplus_{i=l}^ra[i]=\sum\limits_{i=l}^ra[i]\). 题解: 小结论:\(a\oplus b=a+b\rightarrow a\&b=0\). 对每个点来说,考虑向右延伸能够满足条件的右端点的位置,显然右端点的位置单调不减,双指针扫一遍即可. 代码如下 #include <cstdio> using namespace std; const int maxn=2e5+10; int n,a[…
[LeetCode]129. Sum Root to Leaf Numbers 解题报告(Python) 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/sum-root-to-leaf-numbers/description/ 题目描述: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a numbe…
404. Sum of Left Leaves [题目]中文版 英文版 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: int sumOfLeftLea…