原创 leetcode 127. Word Ladder[bfs] lintcode 120. 單詞接龍

https://leetcode.com/problems/word-ladder/ Given two words (beginWord and endWord), and a dictionary's word list, find

原创 leetcode 34. Find First and Last Position of Element in Sorted Array【裸二分】

https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ Given an array of integers nums 

原创 lintcode DP 總結

107. Word BreakFollow https://www.lintcode.com/problem/word-break/description Description 中文English Given a string s an

原创 leetcode 904. Fruit Into Baskets[map維護滑動窗口]

https://leetcode.com/problems/fruit-into-baskets/ In a row of trees, the i-th tree produces fruit with type tree[i]. Yo

原创 leetcode 47. Permutations II[排列]

https://leetcode.com/problems/permutations-ii/ Given a collection of numbers that might contain duplicates, return all

原创 ERROR 2006 (HY000) at line 1061: MySQL server has gone away Operation failed with exitcode 1

導入mysql數據表內容,報錯: ERROR 2006 (HY000) at line 1061: MySQL server has gone away Operation failed with exitcode 1 https:/

原创 虛擬機wifi聯網

由於畢業前想提前學習->學py框架->安裝py2->本機電腦安不上pip->虛擬機就得聯網 今天早上突然意識到昨天沒搞對是因爲沒網線->一頓操作如下: 1.在網絡設置中WLAN的設置中勾選:允許其他網絡用戶通過此計算機的Internet來

原创 由MySQL too many connections引起的事故

問題起因 oj有一個給contest匹配namelist的功能:選擇已經insert的名單,添加到contest的管理界面。 其中有兩個更新名單的按鈕不會自動去重,即 選擇名單後,點擊兩次會插入兩次相同的95人名單,共計190條記錄。 爲

原创 linux python根據csv文件信息 複製圖片到不同文件夾下

import sys import csv import numpy import pandas import shutil import os if __name__ == '__main__': f1 = pandas.read_

原创 lintcode87. 刪除二叉查找樹的節點 leetcode 450. Delete Node in a BST

Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node ref

原创 lintcode 11. 二叉查找樹中搜索區間

  中序遍歷一遍就好啦 /** * Definition of TreeNode: * class TreeNode { * public: * int val; * TreeNode *left, *righ

原创 lintcode 448. 二叉查找樹的中序後繼

本來以爲  既然都是找後繼 都是一樣的 結果 都!不!一!樣! 查找的時候怎麼用val比較呢? 考慮如果當前root的值比查找的 小於或等於:淘汰掉左子樹就好 要是需要找到左子樹了,那麼遞歸下去同樣的方法,如果找不到,那麼說明當前這個根節

原创 lintcode86. 二叉查找樹迭代器

https://www.lintcode.com/problem/binary-search-tree-iterator/description 看着這個題無比眼熟 之前亞麻暑假實習manager問過我 然而 那會是有父指針的 這個題思路

原创 lintcode 85. 在二叉查找樹中插入節點

描述 中文English 給定一棵二叉查找樹和一個新的樹節點,將節點插入到樹中。 你需要保證該樹仍然是一棵二叉查找樹。   保證不會出現重複的值 您在真實的面試中是否遇到過這個題?  是 題目糾錯 樣例 樣例 1: 輸入: tree

原创 lintcode 88LCA

https://lintcode.com/problem/lowest-common-ancestor-of-a-binary-tree/description 描述 中文English 給定一棵二叉樹,找到兩個節點的最近公共父節點(LC