- 安裝Docker
- 安裝Portainer
- 安裝Kubectl
- 安裝Minikube
- 安裝Lens
- 建立Pod和Service
- 從外部連到Pod上執行的Nginx Web Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution(object): | |
| def plusOne(self, digits): | |
| """ | |
| :type digits: List[int] | |
| :rtype: List[int] | |
| """ | |
| # 10 & 3 | |
| sum = 0 | |
| for digit in range(0,len(digits)): | |
| sum = sum + digits[digit] * (10 ** (len(digits) - digit -1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 安裝pip3 | |
| sudo apt-get install python3-pip | |
| 安裝virtualenv | |
| pip3 install virtualenv | |
| 要先檢查目前系統環境的python是哪一個版本 | |
| which python3 | |
| 將虛擬環境套件包安裝在要開發的路徑底下,以/home/schoolproject/demo為例 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution(object): | |
| def matrixReshape(self, mat, r, c): | |
| """ | |
| :type mat: List[List[int]] | |
| :type r: int | |
| :type c: int | |
| :rtype: List[List[int]] | |
| """ | |
| # 先計算row和colume分別是多少 | |
| num_r, num_c = len(mat),len(mat[0]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution(object): | |
| def maxProfit(self, prices): | |
| """ | |
| :type prices: List[int] | |
| :rtype: int | |
| """ | |
| # 紀錄哪一天買入為最低點,碰到當前價格減去最低點價格為最大值時,將值傳給profit | |
| buy = sys.maxint-1 | |
| profit = 0 | |
| for price in prices: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution(object): | |
| def intersect(self, nums1, nums2): | |
| """ | |
| :type nums1: List[int] | |
| :type nums2: List[int] | |
| :rtype: List[int] | |
| """ | |
| # 用兩個dict裝值跟出現次數,再比較出現次數的最小值,避免多加入沒有交集的數值 | |
| nums1_dict = {} | |
| nums2_dict = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution(object): | |
| def merge(self, nums1, m, nums2, n): | |
| """ | |
| :type nums1: List[int] | |
| :type m: int | |
| :type nums2: List[int] | |
| :type n: int | |
| :rtype: None Do not return anything, modify nums1 in-place instead. | |
| """ | |
| # 不能對nums1有任何的回傳值,兩個陣列相加後將值丟給nums1也不行 |
- 建立Minikube Cluster 模擬真正Kubernetes Cluster運行的狀態
- 在Ubuntu上安裝Docker
- 啟動Portainer 以監看Docker元件在機器上的狀態
- 透過指令建立Pod 和 Service 物件
- 可以使用Lens檢查Cluster上的Pod和Service的狀態
Step1. 定義兩個變數 curSum 和 curMax,分別代表目前的加總值 & 目前的比較最大值
Step2. 初始化curSum為0 & curMax為負無限大
Step3. 開始對陣列進行迭代,若curSum的值大於curMax,則curMax = curSum,且若curSum的值小於0,則curSum = 0
Step4. 最後則return curMax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution(object): | |
| def maxSubArray(self, nums): | |
| """ | |
| :type nums: List[int] | |
| :rtype: int | |
| """ | |
| # 邏輯通,但是會Time Limit Exceeded | |
| # compare = nums[0] | |
| # for j in range(0,len(nums)): | |
| # total = 0 |
NewerOlder