103:二叉树的锯齿形层序遍历
This commit is contained in:
huangge1199 2021-04-06 12:56:59 +08:00
parent b928c97241
commit 7c88ef05d1
4 changed files with 36 additions and 2 deletions

View File

@ -28,6 +28,7 @@ package leetcode.editor.cn;
import com.code.leet.entiy.TreeNode; import com.code.leet.entiy.TreeNode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
@ -36,6 +37,8 @@ public class BinaryTreeZigzagLevelOrderTraversal {
public static void main(String[] args) { public static void main(String[] args) {
//测试代码 //测试代码
Solution solution = new BinaryTreeZigzagLevelOrderTraversal().new Solution(); Solution solution = new BinaryTreeZigzagLevelOrderTraversal().new Solution();
List<Integer> list = Arrays.asList(3,9,20,null,null,15,7);
solution.zigzagLevelOrder(new TreeNode(list));
} }
//力扣代码 //力扣代码
//leetcode submit region begin(Prohibit modification and deletion) //leetcode submit region begin(Prohibit modification and deletion)

View File

@ -0,0 +1,31 @@
//给定一个直方图(也称柱状图)假设有人从上面源源不断地倒水最后直方图能存多少水量?直方图的宽度为 1
//
//
//
// 上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的直方图在这种情况下可以接 6 个单位的水蓝色部分表示水 感谢 Marco
//s 贡献此图
//
// 示例:
//
// 输入: [0,1,0,2,1,0,1,3,2,1,2,1]
//输出: 6
// Related Topics 数组 双指针
// 👍 168 👎 0
package leetcode.editor.cn;
//面试题 17.21:直方图的水量
public class VolumeOfHistogramLcci{
public static void main(String[] args) {
//测试代码
Solution solution = new VolumeOfHistogramLcci().new Solution();
}
//力扣代码
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
public int trap(int[] height) {
}
}
//leetcode submit region end(Prohibit modification and deletion)
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long