• 2021/8/25


    leetcode3题

    重新学习了下红黑树 平衡二叉树 堆

    mysql 5讲

    两篇面经学习

    今天状态不是很好

    ```
    //笔记将同步在小程序中,便于复
    class Solution {
    public:
        int trap(vector<int>& height) {
            int area = 0,pre = 0,ans = 0;
           for(int i = 1; i < height.size(); i ++){
              if(height[i] >= height[pre]) {
                  ans = ans + area;
                  pre = i;
                  area = 0;
                  continue;
              }
              area += height[pre] - height[i];
              
           }
           area = 0; pre = height.size() - 1;
           for(int i = height.size() - 2; i >= 0; i --){
              if(height[i] > height[pre]) {
                  ans = ans + area;
                  pre = i;
                  area = 0;
                  continue;
              }
              area += height[pre] - height[i];
           }
           return ans;
        }
    };
    ```
    

      

    class Solution {
    public:
        int dp[550][550] = {0};
        int minDistance(string word1, string word2) {
            for(int i = 0; i <= word2.size(); i ++){
                dp[0][i] = i;
            }
            for(int i = 0; i <= word1.size(); i ++){
                dp[i][0] = i;
            }
            for(int i = 1; i <= word1.size(); i ++){
                for(int j = 1; j <= word2.size(); j ++){
                    if(word1[i - 1] == word2[j - 1]){
                        dp[i][j] = min(dp[i - 1][j - 1],min(dp[i - 1][j] + 1,dp[i][j - 1] + 1));
                    } else {
                        dp[i][j] = min(dp[i - 1][j - 1] + 1,min(dp[i - 1][j] + 1,dp[i][j - 1] + 1));
                    }
                }
            }
            return dp[word1.size()][word2.size()];
        }
    };
    

      

  • 相关阅读:

    JVM基础
    rpm、yum、解压缩安装
    Vim使用及账号用户管理
    linux常用操作
    属主权限和属组权限
    解决Hystrix Dashboard 一直是Loading ...的情况
    扫描不到了@FeignClient注解的调用接口
    springcloud与springboot版本问题
    【力扣】6和9组成的最大数字 题解
  • 原文地址:https://www.cnblogs.com/yrz001030/p/15187141.html
Copyright © 2020-2023  润新知