zoukankan      html  css  js  c++  java
  • 2018-10-25-weekly

    Algorithm

    94. 二叉树的中序遍历

    • What 给定一个二叉树,返回它的中序遍历。

    • How 二叉树的中序遍历顺序为左-根-右,可以用递归来解,对左子结点调用递归函数,根节点访问值,右子节点再调用递归函数即可。

    • Key Codes

    class Solution {
        public static List<Integer> inorderTraversal(TreeNode root) {
            List<Integer> ans = new ArrayList<Integer>();
            inorder(root, ans);
            return ans;
        }
    
        public static void inorder(TreeNode root, List<Integer> ans) {
            if (root == null) return;
            if (root.left != null) {
                inorder(root.left, ans);
            }
            ans.add(root.val);
            if (root.right != null) {
                inorder(root.right, ans);
            }
        }
    }
    

    Review

    The Changing Role of IT in the Future of Business

    • What IT部门面临着广泛的挑战,需要他们推动远远超出传统功能的业务成果。

    • How 创新并为推动业务发展做出贡献

    Tip

    • What 工作中经常遇到很多需求是这样的,根据条件汇总某些字段,比如我遇到的是:求几个数之和,如 3 + 5 +7 = 15,要把最后的和 15 以及计算过程3 + 5 +7都记录下来。

    • How oracle中的listagg函数就可以满足它,需要注意的事项如下:

    SELECT LISTAGG(ACCOUNT_AMOUNT,'+') WITHIN GROUP (ORDER BY TELECOM_DETAIL_ID)  FROM BILL_TELECOM_STATION_DETAIL GROUP  BY TELECOM_BILL_ID 
    
    1. 必须得分组,也就是说group by是必须的。
    2. listagg函数的第一个参数是需要显示的字段,也就是ACCOUNT_AMOUNT;第二个参数是数值之间的分隔符;同时还需要进行排序和分组within group (order by TELECOM_BILL_ID )

    Share

    “拼”出一个5G之城

  • 相关阅读:
    django的用户认证模块(auth)
    算法
    图书管理系统
    mac系统中pycharm激活
    mac常见问题
    mysql安装
    restful规范及DRF基础
    MySQL存储引擎
    [python] with statement
    MySQL索引及执行计划
  • 原文地址:https://www.cnblogs.com/lanqingyu/p/9852366.html
Copyright © 2011-2022 走看看