leetcode
桎皓
励志成为开发工程师的小白一只
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
面试题 08.04. 幂集
题解: class Solution { public List<List<Integer>> subsets(int[] nums) { List<List<Integer>> lists =new ArrayList<>(); lists.add(new ArrayList<>()); for(int n:nums){ int length = lis.原创 2020-07-22 21:43:35 · 303 阅读 · 0 评论 -
leetcode题目:1315. 祖父节点值为偶数的节点和(中等)
给你一棵二叉树,请你返回满足以下条件的所有节点的值之和: 该节点的祖父节点的值为偶数。(一个节点的祖父节点是指该节点的父节点的父节点。) 如果不存在祖父节点值为偶数的节点,那么返回 0 。 示例: 输入:root = [6,7,8,2,7,1,3,9,null,1,4,null,null,null,5] 输出:18 解释:图中红色节点的祖父节点的值为偶数,蓝色节点为这些红色节点的祖父节点。 方法一:深度优先遍历 /** * Definition for a binary tree node. *原创 2020-07-12 22:38:45 · 327 阅读 · 0 评论
分享