Python
LeetCode: 985-Sum of Even Numbers After Queries 解題紀錄
題目
You are given an integer array nums
and an array queries
where queries[i] = [vali, indexi]
.
LeetCode: 609-Find Duplicated File in System 解題紀錄
題目
Given a list paths
of directory info, including the directory path, and all the files with contents in this directory, return all the duplicate files in the file system in terms of their paths. You may return the answer in any order.
LeetCode: 2007-Find Original Array From Doubled Array
題目
An integer array original
is transformed into a doubled array changed
by appending twice the value of every element in original
, and then randomly shuffling the resulting array.
LeetCode: 1457-Pseudo-Palindromic Paths in a Binary Tree 解題紀錄
題目
Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be pseudo-palindromic if at least one permutation of the node values in the path is a palindrome.
Read More »LeetCode: 1457-Pseudo-Palindromic Paths in a Binary Tree 解題紀錄LeetCode: 393-UTF-8 Validation 解題紀錄
題目
Given an integer array data
representing the data, return whether it is a valid UTF-8 encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters).
LeetCode: 948-Bag of Tokens 解題紀錄
題目
You have an initial power of power
, an initial score of 0
, and a bag of tokens
where tokens[i]
is the value of the ith
token (0-indexed).
[Python] 正規表示法(Regular Expression)取代字串時保留關鍵字
如果在用 Python 處理字串時,我們需要匹配一個特殊的關鍵字,然後在左右側添加 HTML 的標籤,我們應該怎麼做呢?
Read More »[Python] 正規表示法(Regular Expression)取代字串時保留關鍵字[已解決] HuggingFace Transformers 模型返回 “‘ValueError: too many values to unpack (expected 2)’, upon training a Bert binary classification model”
在現今深度學習的框架中,無論是使用 Tensorflow、PyTorch 還是其他框架,模型的輸入輸出、資料流向…… 等等,我們都需要十分注意其資料的形狀(shape)。因為一不小心,就會讓模型架構回傳錯誤訊息。
Read More »[已解決] HuggingFace Transformers 模型返回 “‘ValueError: too many values to unpack (expected 2)’, upon training a Bert binary classification model”