
[LeetCode#739] Daily Temperatures
·
Algorithm/문제풀이
❒ Description제목Daily Temperature링크https://leetcode.com/problems/daily-temperatures/description/자료구조스택시간 복잡도O(n) 이번 문제의 핵심은 인덱스이다. 그리고 두 가지 풀이가 있는데 첫 번째는 Stack + Index 이고, 두 번째는 Index만을 사용하는 문제풀이다. 둘 해결책 모두 O(n)의 시간 복잡도를 가진다. 하지만 두번 째 솔루션이 6ms로 4배정도 빨랐다. ❒ Solution1. Stack아래 코드는 최초에 작성한 코드로 runtime 26ms를 기록한 코드이다. public int[] dailyTemperatures(int[] temperatures) { int[] result = new int[te..