原创 if語句(python)
檢查多個條件,有時你需要兩個條件都爲True時才能執行操作,有時只要有一個條件滿足就可以執行操作,此時則需要關鍵字and和or。 有時候執行操作前必須檢查列表中是否包含特定的值,這時可以使用關鍵字in;若需要確定某些特定的值未
原创 LeetCode 21. Merge Two Sorted Lists——python(easy)——使用了鏈表
題目來源: https://leetcode.com/problems/merge-two-sorted-lists/description/ 題目分析: 題目給出兩個排好序的鏈表,將這兩個鏈表整合成一個新的有
原创 learning R with swirl-Base Graphics
R最有利的地方,在於它很容易可以製圖。本節我們將學習R基本的製圖法。 There is a school of thought that this approach is backwards, that we should
原创 R中的文本數據格式(先發表稍後補充)
在R裏你可以把數據保存爲很多種類型 不僅僅是表格格式 CSV 或者 text 格式 還有一些文本格式。 兩個主要的輸出數據的函數是d
原创 類(python)
創建和使用類 這裏需要注意的有以下幾點: 1.按照約定,在python中,首字母大寫的名稱指的是類。上面定義的那個類中的括號是空的,是因爲我們要從空白建造這個類。f中_init_()是一個特殊的方法,每當你根據Dog類
原创 LeetCode167 Two Sum II - Input array is sorted-python(easy)
題目來源https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/discuss/51249/Python-different-solutions-(two-pointe
原创 LeetCode 28.Implement strStr()-python(easy)
題目來源: https://leetcode.com/problems/implement-strstr/description/題目分析: 輸入兩個字符串haystack和needle,如果needle是haystac
原创 LeetCode 219. Contains Duplicate II-python(easy)
題目來源: https://leetcode.com/problems/contains-duplicate-ii/description/題目分析: 本題是要給定一個整數數組和整數k,找出數組中是否存在兩個不同的索引i和j,
原创 matlab plot函數詳解
在matlab中,plot函數用來繪製二維圖像。1.plot默認格式 plot(x,y)這種格式中,若x,y是向量,則它們必須具有相同的長度。函數將以x爲橫軸,繪製y。
原创 LeetCode189 Rotate Array-python(easy)
題目來源: https://leetcode.com/problems/rotate-array/description/題目分析: 題目給定我們一個數組和要將數組整體向右移動的位數k,k是正數,需要我們得到一個全新的移位後的數組
原创 LeetCode58. Length of Last Word-python(easy)
題目來源: https://leetcode.com/problems/length-of-last-word/description/題目分析: 本題是給定我們一個字符串,讓我們返回最後一個非空字符的長度,需要注意空格也算是一
原创 LeetCode 243 shortest word distance -python(easy)-lock
題目來源:Given a list of words and two words word1 and word2, return the shortest distance between these two words in the l
原创 LeetCode122. Best Time to Buy and Sell Stock II-python(easy)
題目來源: https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/題目分析: 本題同樣給你一個列表,代表股票每天
原创 LeetCode 27. Remove Element——python(easy)
題目來源: https://leetcode.com/problems/remove-element/description/ 題目分析: 本題題目較爲簡單,給定一個數組和一個數值val,將數組中數值等於val的數去
原创 LeetCode88. Merge Sorted Array-python(easy)
題目來源: https://leetcode.com/problems/merge-sorted-array/description/題目分析: 本題是給定兩個排好序的列表nums1和nums2,將其融合成一個排列好的列表