From 2a59d4fff670f89f012fdc280d662be38773b186 Mon Sep 17 00:00:00 2001 From: Martin Hsu <31008681+Martin-Hsu@users.noreply.github.com> Date: Fri, 24 Dec 2021 16:48:52 +0800 Subject: [PATCH] =?UTF-8?q?Update=200739.=E6=AF=8F=E6=97=A5=E6=B8=A9?= =?UTF-8?q?=E5=BA=A6.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 簡化版可以直接i = 0開始 --- problems/0739.每日温度.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/problems/0739.每日温度.md b/problems/0739.每日温度.md index d16416d9..d025e73c 100644 --- a/problems/0739.每日温度.md +++ b/problems/0739.每日温度.md @@ -152,8 +152,7 @@ public: vector dailyTemperatures(vector& T) { stack st; // 递减栈 vector result(T.size(), 0); - st.push(0); - for (int i = 1; i < T.size(); i++) { + for (int i = 0; i < T.size(); i++) { while (!st.empty() && T[i] > T[st.top()]) { // 注意栈不能为空 result[st.top()] = i - st.top(); st.pop();