原创 【Leetcode】287. Find the Duplicate Number My Submissions QuestionEditorial Solution python實現

題目:Find the Duplicate Number My Submissions QuestionEditorial Solution Given an array nums containing n + 1 integer

原创 [leetcode]Two Sum C++ python實現

方法一:用HASH表,將每個數x依次放入hash表中;然後檢查hash表有沒有有沒有target-x的數,有就輸出。 python實現:class Solution(object): """docstring for ClassN

原创 [leetcode] 17. Letter Combinations of a Phone Number ,python實現【medium】

Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations that the nu

原创 【leetcode】Container with most water--python實現

題目: Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical li

原创 文章標題

模式識別複習demo 3.3貝葉斯估計 在損失函數爲λ(θ,θ^)=(θ−θ^) 時,貝葉斯估計量爲: θ∗=argminθ^R(θ^|X)=E(θ|X) 最大斯然估計與貝葉斯估計比較 最大似然估計方法優點: 計算簡單,貝

原创 [leetcode]Generate Parentheses 生成圓括號 python實現

Generate Parentheses生成圓括號 Given n pairs of parentheses, write a function to generate all combinations of well-form

原创 GMM-hmm算法學習筆記

 一、基礎 設X是一串已經觀察的聽覺特徵向量,W表示一個詞序列。那麼最可能的詞序列就是W*: 貝葉斯準則 其中P(X|W)是聲學模型,P(W)是語言模型。 Lexicon是字典。HMM模型就是一種聲學模型。 ‘下面舉個例子:

原创 [leetcode] 19. Remove Nth Node From End of List python實現【easy】

Remove Nth Node From End of List My Submissions QuestionEditorial Solution Given a linked list, remove the nth

原创 模式識別入門與貝葉斯決策理論

關鍵詞:監督模式和非監督,馬氏距離,bayes決策理論 1.監督模式識別和非監督模式識別的區別 監督學習(supervised pattern recognition):已知要劃分的類別,並且能夠獲得一定數量的類別已知的訓練樣本

原创 【leetcode】Integer to Roman--python實現

題目要求: - 羅馬數規則: 基本字符 I V X L C D M 相應的阿拉伯數字表示爲 1 5 10 50 100 500 1000 相同的數字連寫、所表示的數等於這些數字相加得到的數、如

原创 【轉載】python獲取文件及文件夾大小

使用os.path.getsize函數,參數是文件的路徑。 獲取文件夾大小,即遍歷文件夾,將所有文件大小加和。遍歷文件夾使用os.walk函數 import os from os.path import join, getsiz

原创 【leetcode】3SUM python實現

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets i

原创 雙系統無法引導問題,ubuntu,16.10安裝win10後,無法啓動ubuntu

我有兩個硬盤,一個SATA一個SSD,ubuntu安裝在SATA上,然後裝的ssd的win10。 中間有個插曲,win10裝的教育版的,激活期只有180天,想轉成專業版還不行。所以就刪了重新裝的專業版,再激活的。 之後再開ubuntu就

原创 [leetcode]41. First Missing Positive,C++/python實現,hard難度

題目 Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3

原创 sed正則表達式匹配,各種括號的轉義和不轉義

[ ] 需要匹配的時候,需要轉義(這個是叛徒) echo "[ ]"|sed 's/\[.*\]/aaa/g' ( ) 需要匹配的時候,不要轉義 $echo "( )"|sed 's/( )/c/g' { } 需要匹配的時候,不要