头像

acwingcyc

NEU




离线:57分钟前


最近来访(223)
用户头像
skydegree
用户头像
虎蛋
用户头像
JooKS
用户头像
我呼吸了
用户头像
nk南枫
用户头像
呆_8
用户头像
_accept
用户头像
好喝到喔喔叫的啵啵奶茶
用户头像
markding
用户头像
tomousw
用户头像
king_Lin
用户头像
Behappyeveryday
用户头像
hys52
用户头像
朱帅萌
用户头像
沈七
用户头像
0x3e3e3e3e
用户头像
FlyingPig_6
用户头像
skkdw
用户头像
X-7D1C11010
用户头像
Seveness

分享 配置vue

acwingcyc
1小时前

1. 安装node.js

点击链接,下载对应版本
Node.js


Snipaste_2022-08-16_10-00-54.png


2. 打开cmd,安装npm

npm install -g cnpm --registry=https://registry.npm.taobao.org

cnpm install -g @vue/cli

Snipaste_2022-08-16_10-43-07.png


最后看到一片红代表成功。。。
Snipaste_2022-08-16_10-44-14.png


3. 管理员身份下cmd里输入vue ui

注意: vue ui一定要在管理员身份下运行,否则可能会创建项目失败

vue ui

浏览器里看到这个表示成功了
Snipaste_2022-08-16_10-46-23.png


4. 在vue ui里安装必要插件

首先,先创建一个新项目,过程简单不演示了

出现这个表示项目创建成功了
Snipaste_2022-08-16_11-02-51.png

点击插件,安装推荐的插件即可

Snipaste_2022-08-16_11-03-25.png

点击依赖,安装bootstrap



class Solution {
public:
    int maxProfit(vector<int>& prices) {
        int res = 0;
        for (int i = 0, minp = INT_MAX; i < prices.size(); i ++ ) {
            res = max(res, prices[i] - minp);
            minp = min(minp, prices[i]);
        }
        return res;
    }
};



/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    void flatten(TreeNode* root) {
        while(root) {
            auto p = root->left;
            if(p) {
                while(p->right) p = p->right;
                p->right = root->right;
                root->right = root->left;
                root->left = NULL;
            }
            root = root->right;
        }
    }
};


活动打卡代码 LeetCode 113. 路径总和 II

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    vector<vector<int>> ans;
    vector<int> path;
    vector<vector<int>> pathSum(TreeNode* root, int targetSum) {
        if(root) dfs(root,targetSum);
        return ans;
    }
    void dfs(TreeNode* root,int targetSum) {
        path.push_back(root->val);
        targetSum -= root->val;

        if(!root->left && !root->right) {
            if(targetSum == 0) {
                ans.push_back(path);
            }
        }
        if(root->left) dfs(root->left,targetSum);
        if(root->right) dfs(root->right,targetSum);
        path.pop_back();
    }
};


活动打卡代码 LeetCode 112. 路径总和

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
 * };
 */
class Solution {
public:
    bool hasPathSum(TreeNode* root, int sum) {
        if (!root) return false;
        if (!root->left && !root->right) return root->val == sum;
        if (root->left && hasPathSum(root->left, sum - root->val)) return true;
        if (root->right && hasPathSum(root->right, sum - root->val)) return true;
        return false;
    }
};



/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    int minDepth(TreeNode* root) {
        if(!root) return 0;
        if(!root->left) return minDepth(root->right) + 1;
        if(!root->right) return minDepth(root->left) + 1;
        return min(minDepth(root->left),minDepth(root->right)) + 1;
    }
};



/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    vector<int> inorder;
    vector<int> trans;
    vector<int> ans;
    void recoverTree(TreeNode* root) {
        dfs(root,true);
        sort(trans.begin(),trans.end());

        for(int i = 0;i < inorder.size();i ++)
            if(inorder[i] != trans[i]) ans.push_back(trans[i]);
        dfs(root,false);
    }

    void dfs(TreeNode* root,bool debug) {
        if(debug) {
            if(!root) return;
            dfs(root->left,true);
            inorder.push_back(root->val);
            trans.push_back(root->val);
            dfs(root->right,true);
        }
        else {
            if(!root) return;
            dfs(root->left,false);
            if(root->val == ans[0]) root->val = ans[1];
            else if(root->val == ans[1]) root->val = ans[0];
            dfs(root->right,false);
        }

    }
};



/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode() : val(0), next(nullptr) {}
 *     ListNode(int x) : val(x), next(nullptr) {}
 *     ListNode(int x, ListNode *next) : val(x), next(next) {}
 * };
 */
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    TreeNode* sortedListToBST(ListNode* head) {
        vector<int> nums;
        for(auto p = head;p;p=p->next) nums.push_back(p->val);
        if(nums.size() == 0) return NULL;
        return build(nums,0,nums.size() - 1);
    }
    TreeNode* build(vector<int>& nums,int l,int r) {
        if(l > r) return NULL;
        int mid = l + r >> 1;
        auto root = new TreeNode(nums[mid]);
        root->left = build(nums,l,mid - 1);
        root->right = build(nums,mid+1,r);
        return root;
    }
};



/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    TreeNode* sortedArrayToBST(vector<int>& nums) {
        if(!nums.size()) return NULL;
        return dfs(nums,0,nums.size() - 1);
    }

    TreeNode* dfs(vector<int>& nums,int l,int r) {
        if(l > r) return NULL;
        int k = l + r >> 1;
        auto root = new TreeNode(nums[k]);
        root->left = dfs(nums,l,k-1);
        root->right = dfs(nums,k+1,r);
        return root;
    }
};



/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    vector<vector<int>> levelOrderBottom(TreeNode* root) {
        vector<vector<int>> res;
        queue<TreeNode*> q;

        if(!root) return {};
        q.push(root);

        while(q.size()) {
            int len = q.size();
            vector<int> level;
            while(len --) {
                auto t = q.front();
                q.pop();
                level.push_back(t->val);
                if(t->left) q.push(t->left);
                if(t->right) q.push(t->right);
            }
            res.push_back(level);
        }
        reverse(res.begin(),res.end());
        return res;
    }
};