原创 leetcode 134. Gas Station (Medium)

https://leetcode.com/problems/gas-station/ 非常經典的一道題。解這道題的思路基於一個數學定理: 如果一個數組的總和非負,那麼一定可以找到一個起始位置,從他開始繞數組一圈,累加和一直都是非負

原创 leetcode leetcode 120. Triangle

https://leetcode.com/problems/triangle/submissions/ 解題思路 sumList用來保存上一層路徑的求和結果,nextSumList保存當前層的求和結果,nextSumList[i]

原创 leetcod 152. Maximum Product Subarray (medium)

https://leetcode.com/problems/maximum-product-subarray/ 題目描述 Given an integer array nums, find the contiguous subar

原创 leetcode108/109 Convert Sorted Array to Binary Search Tree

108. Convert Sorted Array to Binary Search Tree 題目描述 給定一個有序升序數組,輸出可能的平衡二叉樹 Example: Given the sorted array: [-10,

原创 linux下使用crontab設置定時任務

文章目錄1. 鍵入 crontab -e 編輯crontab服務文件2. 啓動crontab服務3. 查看服務是否已經運行4. crontab命令5. cron文件語法:6. 任務調度設置文件的寫法新增調度任務查看調度任務刪除

原创 基於虛擬機的hadoop分佈式集羣搭建(搭建成功)

文章目錄1. 安裝VMware、安裝ubuntu16.042. 安裝vim和ssh3. 修改hostname4. 修改hosts5. 安裝jdk6. 安裝hadoop7. 克隆8. 配置ssh,實現免密碼登錄9. 修改hadoo

原创 leetcode 146. LRU Cache (medium)

https://leetcode.com/problems/lru-cache/ 題目描述 Design and implement a data structure for Least Recently Used (LRU) c

原创 leetcode 154. Find Minimum in Rotated Sorted Array II (hard)

154. Find Minimum in Rotated Sorted Array II 題目描述 Suppose an array sorted in ascending order is rotated at some piv

原创 leetcode高頻面試題

文章目錄一. 寫在開頭二. 高頻題三. 題解1. Two Sum [Difficulty: Easy15. 3Sum [Difficulty: Medium]20. Valid Parentheses [Difficulty: E

原创 面試中的 10 大排序算法總結

原文鏈接:http://www.codeceo.com/article/10-sort-algorithm-interview.html#0-tsina-1-10490-397232819ff9a4

原创 leetcode 1-100 medium難度題目彙總

寫在前面 近半個月的整理, 終於完成了前一百題的easy和medium題目的分析 😅 秋招已經開始了, 祝自己好運 😇 以後有空逐漸把hard補上 😎 文章目錄2. Add Two Numbers (Medium)3. Longe

原创 轉載 二分查找關於邊界問題的坑點與總結

原文鏈接:https://blog.csdn.net/haolexiao/article/details/53541837 原文鏈接:https://blog.csdn.net/haol

原创 leetcode 198. House Robber (easy)

198. House Robber 題目描述 從一個數組中取(rob)若干數, 使得結果(money)最大, 這些數不能相鄰 Input: [1,2,3,1] Output: 4 Explanation: Rob house 1

原创 leetcode 199. Binary Tree Right Side View

199. Binary Tree Right Side View 題目描述 假設站在二叉樹右側, 求能看到的節點. 解題思路 層序遍歷, 每層的最後一個就是能被看到的. 代碼 Python # Definition for a b

原创 leetcode 200. Number of Islands

200. Number of Islands 題目描述 1 代表島嶼, 0 代表海洋, 1 被 0 包圍算作一個島嶼. 只要1被連接, 都只能算一個島嶼. 解題思路 用DFS解題. 遍歷grid所有點, 如果grid[i][j]=