LeetCode: 1026. Maximum Difference Between Node and Ancestor 解題紀錄
題目
Given the root
of a binary tree, find the maximum value v
for which there exist different nodes a
and b
where v = |a.val - b.val|
and a
is an ancestor of b
.
Given the root
of a binary tree, find the maximum value v
for which there exist different nodes a
and b
where v = |a.val - b.val|
and a
is an ancestor of b
.
『量子物理學』(quantum physics)是一個廣泛應用但鮮為人知的術語。簡單來說,量子物理學是一個描述微觀世界中粒子如何運動的數學模型。
Read More »[Qiskit] 什麼是量子(Quantum)?Consider all the leaves of a binary tree, from left to right order, the values of those leaves form a leaf value sequence.
Read More »LeetCode: 872-Leaf-Similar Trees 解題紀錄Given the head
of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list.
Given the head
of a singly linked list, return the middle node of the linked list.
If there are two middle nodes, return the second middle node.
Read More »LeetCode: 876-Middle of the Linked List 解題紀錄You are given a 0-indexed integer array nums
of length n
.
The average difference of the index i
is the absolute difference between the average of the first i + 1
elements of nums
and the average of the last n - i - 1
elements. Both averages should be rounded down to the nearest integer.
Given a string s
, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string.
在正式開始撰寫、設計量子電腦的程式之前,我們有必要在 Python 中安裝 Qiskit 套件,因為 Qiskit 是基於 Python3.7 以後的版本進行開發的。
Read More »[Qiskit] 安裝筆記 - Installation今天在刷題的時候,看到一位分享自己解題思路的網友,他的程式碼中所有宣告的 vector
陣列,全部都使用 emplace_back()
。那時候我可看不明白了,從我在大學上課開始寫時,老師都是教寫 push_back()
的啊?
今天我在進行深度學習的資料前處理時,發現有個資料集中的標籤名稱特別的多樣,但是為了可讀性,我需要把這些資料分別使用不同的變數名稱來儲存,不能每次調用時都用 key 值來取值(其實是為了和之前在好的固定模版配合)。
Read More »[Python] 把 Dict 字典中的 key 值解開成變數