Algorithm
LeetCode98. 验证二叉搜索树
好久(一个多星期了)没写算法题了,然后变菜了好多…所以还是要多多练习,不然没有题感了…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| class Solution {
public: unordered_set<int> s;
bool solve(TreeNode *root,int min,int max){ if(root == NULL) return true; int val = root->val; if(s.find(val)!=s.end()) return false; else s.insert(val); if(min>val) return false; if(max<val) return false; return solve(root->left,min,val) && solve(root->right,val,max); }
bool isValidBST(TreeNode* root) { if(root == NULL || (root->left == NULL && root->right == NULL) ) return true; return solve(root,INT_MIN,INT_MAX); } };
|
LeetCode98. 验证二叉搜索树 ans
Review
观看了电影心灵捕手
- 正视自己的一切不完美,去接纳它们
- 只有真正热爱,才能一直热泪盈眶,Follow your heart
- 心之所向,胜过一切荣耀
- 去爱,去信任,去找到那个可以互相接纳不完美又互相爱护的人
Tips
VScode远程开发
将公钥拷贝到服务器上:ssh-copy-id username@your.ip.2.*
Share
复制硬盘中的Ubuntu/Deepin到移动硬盘_实现移动硬盘Deepin+Ubunntu双系统
复制硬盘中的Ubuntu/Deepin到移动硬盘_实现移动硬盘Deepin+Ubunntu双系统
Share_三种清除Git提交历史的方法
参考大佬:
三种清除Git提交历史的方法
Git如何永久删除文件(包括历史记录)
我自己的操作,因为一次误传,导致整整搞了4个多小时左右…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| 单林敏@DESKTOP-A7T3V67 MINGW64 ~/Desktop/Blog (master) $ git filter-branch --force --index-filter 'git rm --cached -r --ignore-unmatch 生活/微信备份/8月13-11月19与昭\(夹34其他\)/android_eda93ed7432c852f294c0f6c71fb3352/ && git rm --cached -r Latex/' --prune-empty --tag-name-filter cat -- --all Rewrite 67c9d71d4e60028c54451053e4d0eb6e733b7586 (1/96) (1 seconds passed, remaining 95 predicted) fatal: pathspec 'Latex/' did not match any files index filter failed: git rm --cached -r --ignore-unmatch 生活/微信备份/8月13-11月19与昭\(夹34其他\)/android_eda93ed7432c852f294c0f6c71fb3352/ && git rm --cached -r Latex/
单林敏@DESKTOP-A7T3V67 MINGW64 ~/Desktop/Blog (master) $ git filter-branch --force --index-filter 'git rm --cached -r Latex/' --prune-empty --tag-name-filter cat -- --all Rewrite 67c9d71d4e60028c54451053e4d0eb6e733b7586 (1/96) (0 seconds passed, remaining 0 predicted) fatal: pathspec 'Latex/' did not match any files index filter failed: git rm --cached -r Latex/
单林敏@DESKTOP-A7T3V67 MINGW64 ~/Desktop/Blog (master) $ git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch 生活/微信备份/8月13-11月19与昭\(夹34其他\)/android_eda93ed7432c852f294c0f6c71fb3352/BAK_0_MEDIA' --prune-empty --tag-name-filter cat -- --all Rewrite 3279ddb863731866633999b43860045b1c0ceb05 (93/96) (64 seconds passed, remaining 2 predicted) rm '生活/微信备份/8月13-11月19与昭(夹34其他)/android_eda93ed7432c852f294c0f6c71fb3352/BAK_0_MEDIA' Rewrite 2f64cd075e37f29a8559d7bbd8282d0b70bea117 (95/96) (66 seconds passed, remaining 0 predicted) Ref 'refs/heads/master' was rewritten WARNING: Ref 'refs/remotes/wolfdan.cn/master' is unchanged
单林敏@DESKTOP-A7T3V67 MINGW64 ~/Desktop/Blog (master) $ git push wolfdan.cn master --force --all fatal: --all can't be combined with refspecs
单林敏@DESKTOP-A7T3V67 MINGW64 ~/Desktop/Blog (master) $ git push wolfdan.cn master --force Enumerating objects: 26, done. Counting objects: 100% (26/26), done. Delta compression using up to 8 threads Compressing objects: 100% (20/20), done. Writing objects: 100% (22/22), 6.41 MiB | 584.00 KiB/s, done. Total 22 (delta 6), reused 10 (delta 1) remote: Checking connectivity: 22, done. remote: Powered by GITEE.COM [GNK-3.8] To gitee.com:wolfdan/wolfdan.cn.git a21c409..50fecff master -> master
单林敏@DESKTOP-A7T3V67 MINGW64 ~/Desktop/Blog (master) $ git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch -rf 生活/微信备份/' --prune-empty --tag-name-filter cat -- --all Rewrite 7eadb383a4da06293c8c6f8cd38da878221d00de (93/96) (63 seconds passed, remaining 2 predicted) rm '生活/微信备份/8月13-11月19与昭(夹34其他)/android_eda93ed7432c852f294c0f6c71fb3352/BAK_0_TEXT' rm '生活/微信备份/8月13-11月19与昭(夹34其他)/android_eda93ed7432c852f294c0f6c71fb3352/Backup.db' Rewrite 50fecff951f7eb6e8a8a908594d06f448ce1e873 (95/96) (64 seconds passed, remaining 0 predicted) Ref 'refs/heads/master' was rewritten Ref 'refs/remotes/wolfdan.cn/master' was rewritten
单林敏@DESKTOP-A7T3V67 MINGW64 ~/Desktop/Blog (master) $ rm -rf .git/refs/original/
单林敏@DESKTOP-A7T3V67 MINGW64 ~/Desktop/Blog (master) $ git reflog expire --expire=now --all
单林敏@DESKTOP-A7T3V67 MINGW64 ~/Desktop/Blog (master) $ git gc --prune=now Enumerating objects: 1401, done. Counting objects: 100% (1401/1401), done. Delta compression using up to 8 threads Compressing objects: 100% (1068/1068), done. Writing objects: 100% (1401/1401), done. Total 1401 (delta 302), reused 1396 (delta 301)
|
清理了一下,感觉.git
文件变小了好多,好爽