Leetcode#337. House Robber III
ProblemThe thief has found himself a new place for his thievery again. There is only one entrance to this area, called root.
Besides the root, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will automatically contact the police if two directly-linked houses were broken into on the same night.
Given the root of the binary tree, return the maximum amount of money the thief can rob without alerting the police ...
紀錄Amazon從購買到送達時間
發貨地點在美國
D 2023/9/25下單
D+4 2023/9/29 中秋節
D+7 2023/10/2 發貨
D+9 2023/10/4 ezway 預先委任
D+11 2023/10/6 入港口 清關
D+12 2023/10/7 送至派送商倉庫
D+15 、D+16 2023/10/9 202310/10 國慶放假
D+17 2023/10/12 12:03 出貨
D+18 2023/10/12 10:00 再次顯示 開始送貨並預計今天抵達
D+18 2023/10/12 15:40 寄Email,很抱歉,ECMS Express 嘗試遞送給您時遇到問題。 他們會再試一次。
D+19 2023/10/13 11:29 收到貨
經歷15天工作天 、4天周末日(共19天)
工作天2天受到假期影響(雙十國慶,國外沒有過中秋所以沒有影響)
D+18 問客服有何問題,說是電話沒接,去看通訊錄,都電話響2、3秒就掛掉,根本接不到,還以為是詐騙
比原先amzn說D+26(2023/10/20)到貨,早了7天
.Net 上的圖像類型(Bitmap、Image、Mat、UMat)
Bitmap:
Bitmap 是一個在 C# 中常用的圖像類型,它屬於 System.Drawing 命名空間。它用於表示和處理點陣圖圖像。
Bitmap 是一個基於像素的圖像,每個像素都包含顏色信息。您可以輕鬆地創建、讀取、繪製和處理 Bitmap 圖像。
這是一個簡單且易於使用的圖像類型,適用於大多數基本圖像處理需求,但在某些情況下可能會有性能問題。
Image<TColor, TColor>:
Image<TColor, TColor> 通常是指一種泛型圖像類型,通常用於 .NET Core 和 .NET 5+ 中的圖像處理庫,如 SixLabors.ImageSharp。
這是一種較新的圖像類型,支援更多的圖像處理功能,例如縮放、旋轉、濾鏡等。
Image<TColor, TColor> 使用泛型,因此您可以指定圖像的顏色類型(例如 RGB、灰度等),這使得它更具彈性和可擴展性。
Mat:
Mat 是一個常見於 OpenCV(Open Source Computer Vision Library)中的圖像類型,用於 C# 中的 ...
(Bug)C# System.IO.IOException:
System.IO.IOException: ‘由於另一個處理序正在使用檔案 ‘C:....’,所以無法存取該檔案。
123456789101112//原先我用一個path = @"C:\..\.."System.Windows.Controls.Image image = new System.Windows.Controls.Image();image.Source = path//後面我要刪除這個檔案時File.Delete(path)#region 錯誤訊息System.IO.IOException: '由於另一個處理序正在使用檔案 'C:\..\..',所以無法存取該檔案。#endregion
Solve12345678910111213141516171819202122path = @"C:\..\.."System.Windows.Controls.Image image = new System.Windows.Controls.Image();System.Drawing.Image img = ...
python 螢幕、鏡頭錄製
使用pyautogui 、 openCVpyautogui 用來抓螢幕寬高,及螢幕截圖
123456789101112131415161718192021222324252627282930313233343536373839import osimport pyautoguiimport timeimport cv2import numpy as np# 螢幕寬高screen_width, screen_height = pyautogui.size()# 設定視頻文件參數fourcc = cv2.VideoWriter_fourcc(*'XVID')out = cv2.VideoWriter('screen_recording.avi', fourcc, 20.0, (screen_width, screen_height))# 錄製時間(秒)duration = 5# 開始錄製start_time = time.time()while (time.time() - start_time) < duration: # 截取當前螢幕畫 ...
Conda 指令
配置Conda環境以下都是在Anaconda prompt下執行
conda版本1conda update conda
列出和刪除環境、package12345678# 查看已建置環境conda env list# 刪除整個envName的環境conda env remove --name envName# 刪除envName中pandas 的packageconda remove --name envName pandas
創建新環境12# 建置名為envName的環境conda create --name envName python=3.10
激活和退出環境12345# 激活環境conda activate envName# 退出環境conda deactivate envName
安裝、升級package假定已經在(envName)想要設定的環境底下
12345678# 安裝 matplotlib numpy tensorflow pandas opencv-python conda install matplotlib numpy tensorflow pand ...
visual studio ctrl+z delete whole cell(Solve)
目前找到兩個方法Ctrl + Z 會把Cell刪除,真的是惡夢
可以先試試Ctrl + Y or ESC + Z
左邊 Timeline 也可以找到過去的時間線
Leetcode#53. Maximum Subarray
ProblemGiven an integer array nums, find the
subarray
with the largest sum, and return
its sum
.
Example 1:
1234Input: nums = [-2,1,-3,4,-1,2,1,-5,4]Output: 6Explanation: The subarray [4,-1,2,1] has the largest sum 6.
Example 2:
1234Input: nums = [1]Output: 1Explanation: The subarray [1] has the largest sum 1.
Example 3:
1234Input: nums = [5,4,-1,7,8]Output: 23Explanation: The subarray [5,4,-1,7,8] has the largest sum 23.
Constraints:
1 <= nums.length <= 10^5
10^4 <= nums[i] <= 1 ...
shioaji 永豐API
Quick Start1234!pip install shioaji!pip install -U shioaji# docker run -it sinotrade/shioaji:latest# docker run -p 8888:8888 sinotrade/shioaji:jupyter
Login123456789101112131415161718import shioaji as sjprint(sj.__version__)print("*"*20)# 模擬模式api = sj.Shioaji(simulation = True)# 需到官方網站申請APIaccounts = api.login("YOUR_API_KEY", "YOUR_SECRET_KEY")print(accounts)# 憑證需要先下載永豐windows App ,OS X 就沒有研究了api.activate_ca( ca_path="/c/your/ca/path/Sinopac.pfx ...
Leetcode#202. Happy Number
ProblemWrite an algorithm to determine if a number n is happy.
A happy number is a number defined by the following process:
Starting with any positive integer, replace the number by the sum of the squares of its digits.
Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1.
Those numbers for which this process ends in 1 are happy.
Return true if n is a happy number, and false if not.
Example 1:
12345678Input: n = 19Output: ...