最近在准備找工作的算法題,刷刷LeetCode,以下是我的解題報告索引,每一題幾乎都有詳細的說明,供各位碼農參考。根據我自己做的進度持續更新中...... 本文地址 LeetCode:Reverse Words ...
Sort List Sort a linked list in O n log n time using constant space complexity. 使用Merge Sort, 空間復雜度是 O logN 因為使用了棧空間。 SOLUTION : 使用Merge Sort來解決問題。 為什么不用QuickSort 因為隨機訪問對於鏈表而言太耗時,而heap sort不可行。 注意,Fin ...
2014-11-29 20:55 4 3117 推薦指數:
最近在准備找工作的算法題,刷刷LeetCode,以下是我的解題報告索引,每一題幾乎都有詳細的說明,供各位碼農參考。根據我自己做的進度持續更新中...... 本文地址 LeetCode:Reverse Words ...
Subsets Given a set of distinct integers, S, return all possible subsets. Note: Elements in a ...
LeetCode 1 Two Sum 解題報告 偶然間聽見leetcode這個平台,這里面題量也不是很多200多題,打算平時有空在研究生期間就刷完,跟跟多的練習算法的人進行交流思想,一定的ACM算法積累可以對以后在對算法中優化帶來好處。Ok,今天是我做的第一題Add Two Sum。 題目要求 ...
Word SearchGiven a 2D board and a word, find if the word exists in the grid.The word can be construc ...
Min Stack My Submissions Question Solution Design a stack that supports push, pop, top, an ...
Permutations II Given a collection of numbers that might contain duplicates, return all possible un ...
Distinct Subsequences Given a string S and a string T, count the number of distinct subsequences of ...
Wildcard MatchingImplement wildcard pattern matching with support for '?' and '*'.'?' Matches any si ...