LeetCode: 1007-Minimum Domino Rotations For Equal Row 解題紀錄
題目
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.)
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 虛擬環境選擇排序法(selection sort)同樣是最知名的排序演算法之一,也是相當穩定的排序法。不論是最好的狀況(best case)、平均狀況(average case)、還是最糟的狀況(worst case)通通都是 O(n^2) 的時間複雜度。
Read More »[資料結構] 選擇排序法(Selection Sort)