LeetCode: 309-Best Time to Buy and Sell Stock with Cooldown 解題紀錄
題目
You are given an array prices
where prices[i]
is the price of a given stock on the ith
day.
You are given an array prices
where prices[i]
is the price of a given stock on the ith
day.
There are n
rooms labeled from 0
to n - 1
and all the rooms are locked except for room 0
. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key.
前一個章節我們使用 Qiskit 實作了一個半加法器(Half Adder)。現在,我們已經知道了什麼是『位元』(bits)、以及傳統電腦的部分工作原理。
Read More »[Qiskit] 量子位元狀態的表示法There is a bi-directional graph with n
vertices, where each vertex is labeled from 0
to n - 1
(inclusive). The edges in the graph are represented as a 2D integer array edges
, where each edges[i] = [ui, vi]
denotes a bi-directional edge between vertex ui
and vertex vi
. Every vertex pair is connected by at most one edge, and no vertex has an edge to itself.
Given an array of integers temperatures
represents the daily temperatures, return an array answer
such that answer[i]
is the number of days you have to wait after the ith
day to get a warmer temperature. If there is no future day for which this is possible, keep answer[i] == 0
instead.
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Read More »LeetCode: 150-Evaluate Reverse Polish Notation 解題紀錄隨著時代的進步,現在人們已經可以在舒適的家裡進行量子電腦的程式設計了。但是話說回來,我們究竟要創造什麼呢?什麼是量子程式設計呢?說到底,什麼又是量子電腦呢?
Read More »[Qiskit] 使用量子電路實作半加法器(Half Adder)You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjacent houses were broken into on the same night.
Read More »LeetCode: 198-House Robber 解題紀錄Given an n x n
array of integers matrix
, return the minimum sum of any falling path through matrix
.
You are climbing a staircase. It takes n
steps to reach the top.
Each time you can either climb 1
or 2
steps. In how many distinct ways can you climb to the top?