网站首页 站内搜索

搜索结果

查询Tags标签: recur,共有 4条记录
  • offer06 c++

    class Solution { public:vector<int> reversePrint(ListNode* head) {//采用递归法recur(head);//创建了recur函数,输入为headreturn res;//返回得到的res} private:vector<int> res;//定义int的叫做res的矢量int recur(ListNode* head) {//一个函数,输入为…

    2022/1/29 1:05:07 人评论 次浏览
  • 剑指 Offer 28. 对称的二叉树

    https://leetcode-cn.com/problems/dui-cheng-de-er-cha-shu-lcof/class Solution {public boolean isSymmetric(TreeNode root) {return root == null ? true : recur(root.left, root.right);}boolean recur(TreeNode L, TreeNode R){//如果两边都是空的,trueif(L == n…

    2021/11/9 23:14:16 人评论 次浏览
  • 剑指 Offer 28. 对称的二叉树

    https://leetcode-cn.com/problems/dui-cheng-de-er-cha-shu-lcof/class Solution {public boolean isSymmetric(TreeNode root) {return root == null ? true : recur(root.left, root.right);}boolean recur(TreeNode L, TreeNode R){//如果两边都是空的,trueif(L == n…

    2021/11/9 23:14:16 人评论 次浏览
  • 判断平衡二叉树

    平衡二叉树 输入一棵二叉树的根节点,判断该树是不是平衡二叉树。如果某二叉树中任意节点的左右子树的深度相差不超过1,那么它就是一棵平衡二叉树。 class Solution:def isBalanced(self, root: TreeNode) -> bool:def recur(root):if not root:return 0left =recur(r…

    2021/4/10 18:46:35 人评论 次浏览
扫一扫关注最新编程教程