LeetCode: 991-Broken Calculator 解題紀錄
題目
There is a broken calculator that has the integer startValue
on its display initially. In one operation, you can:
There is a broken calculator that has the integer startValue
on its display initially. In one operation, you can:
The numeric value of a lowercase character is defined as its position (1-indexed)
in the alphabet, so the numeric value of a
is 1
, the numeric value of b
is 2
, the numeric value of c
is 3
, and so on.
You are given a string s
. We want to partition the string into as many parts as possible so that each letter appears in at most one part.
In a row of dominoes, tops[i]
and bottoms[i]
represent the top and bottom halves of the ith
domino. (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.)
Given a string s
, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.
Given a balanced parentheses string s
, return the score of the string.
我一直以來都希望能夠保存 PyTorch 訓練模型時所使用的優化器(optimizer),以便能夠在模型結束訓練之後,繼續往下訓練;一般來說,如果是要做遷移學習、微調模型(fine-tune),那麼並不需要特別將上一次訓練的優化器保存下來。
Read More »[PyTorch] 保存優化器(optimizer)來接續訓練模型最近我將一些私人環境搬遷到 VS Code 上面去了,但是這之中碰到一個小問題:VS Code 預設支援的 Python 語法解析是基於全域環境,而我則習慣在每個不同的 Python 專案中啟用不同的虛擬環境。
Read More »[VS Code] 在專案中啟用 Python 虛擬環境