原创 【leetcode】387. First Unique Character in a String

提交代碼 class Solution { public int firstUniqChar(String s) { HashMap<Character, Integer> map=new HashMap<

原创 【leetcode】1443. Minimum Time to Collect All Apples in a Tree

用遞歸 提交代碼 class Solution { public int minTime(int n, int[][] edges, List<Boolean> hasApple) { TreeNode[]

原创 【leetcode】1399. Count Largest Group

提交代碼 class Solution { public int countLargestGroup(int n) { int digitSum, maxSize=0,res=0; Map<Int

原创 【MySQL】學習筆記2

文章目錄等值連接、非等值連接內連接、外連接、交叉連接子查詢(內查詢)分頁查詢聯合查詢union 等值連接、非等值連接 等值連接:就是在where的條件裏面是左表字段=右表字段 非等值連接:就是在where條件裏左表的字段 betw

原创 【leetcode】208. Implement Trie (Prefix Tree)

提交代碼 class Trie { ArrayList<String> trie; /** Initialize your data structure here. */ public Trie() {

原创 【python】服務器持續在後臺運行腳本

實現目標 可以在服務器上跑一個腳本,後臺執行,且本地退出SSH會話後,該程序要一直執行 實現方式 使用nohup運行該腳本 nohup python /path/to/python/file.py & 執行完上面的命令後按任意鍵

原创 【 MongoDB】重命名數據庫、集合、字段名

重命名數據庫: db.copyDatabase('old_name', 'new_name'); use old_name db.dropDatabase(); 重命名collection: db.old_collection_

原创 【MongoDB】讓MongDB一直在後臺運行

單純運行mongodb會在退出終端時終止mongodb的服務: mongod --dbpath=/usr/local/mongodbDATA/db --logpath=/usr/local/mongodbDATA/log 只要在執

原创 【leetcode】395. Longest Substring with At Least K Repeating Characters

提交代碼 class Solution { public int longestSubstring(String s, int k) { if(s==null) return 0; int res

原创 【leetcode】1419. Minimum Number of Frogs Croaking

提交代碼 class Solution { public int minNumberOfFrogs(String croakOfFrogs) { ArrayList<Integer> allCroaks=new

原创 【MySQL】學習筆記1

文章目錄去重拼接字符串顯示錶結構去除null值的影響where中的條件運算符模糊查詢安全等於`<=>`排序大小寫截取字符串日期其他函數流程控制函數分組函數group by 去重 select distinct fieldname

原创 SSH登錄認證

概念 Telnet是一種和遠程主機通信的協議,但是沒有通信安全保障,而SSH(Secure Shell)是替代Telnet用於計算機之間加密登錄的網絡協議。 使用SSH之後client訪問server就不用每次都輸入密碼再進去了。

原创 【Leetcode】412. Fizz Buzz

提交代碼 class Solution { public List<String> fizzBuzz(int n) { List<String> res=new ArrayList<>();

原创 【leetcode】454. 4Sum II

解題思路 四個數組中,找出組合之和爲0的個數。一般想到的是4個for循環,時間複雜度O(n^4),耗時太久了。可以考慮犧牲空間換取時間。將A B兩個數組中數字的組合值用map保存起來,然後再遍歷C D數組。綜合時間複雜度O(N^2

原创 牛客網在線面試-解決問題Compiler did not create the expected binary

之前在牛客網在線面試的時候用java編譯有問題,明明在本地的eclipse上可以編譯通過,在線面試的時候就編譯不出來,代碼如下: class Interview01{ public static void main(String