(◍´ಲ`◍)嗨,我是wec,今天是DAY 13。 🔎 題目難度與描述 難度:MEDIUM 題目描述: 給定一個二元樹,找出其最大深度。1.二元樹的深度:從根節...
前言 嘿嘿~我們又來啦!延續上次那道 Longest Valid Parentheses 的題目,上次我們用的是堆疊方法來解決這個「括號迷宮」,今天我們換一...
TypeScript 映射型別進階技巧 🎯 在使用 TypeScript 的過程中,我們經常會遇到需要將一個型別轉換成另一個型別的需求。映射型別(Mapped...
Description Min Stack Design a stack that supports push, pop, top, and retriev...
(⑉˙ᗜ˙⑉)嗨,我是wec,今天是DAY 12。 🔎 題目難度與描述 難度:MEDIUM 題目描述: House Robber系列的第三道題目!不同於前兩題的...
Description Design Circular Queue Design your implementation of the circular q...
前言 今天我們來挑戰的是 Climbing Stairs(爬樓梯)這道題目!想像一下,你站在樓梯的底部,目標是爬到最頂端,每次可以選擇走一步或兩步。問題是:有...
Description Implement Queue using Stacks Implement a first in first out (FIFO)...
Description Implement a last-in-first-out (LIFO) stack using only two queues. Th...
🟨編輯距離 本題取自 Leetcode 72. Edit Distance 題目 Given two strings word1 and word2, retu...
這次我們來解一道二元樹的題目:Diameter of Binary Tree,這道題目的關鍵在於找到二元樹中兩個節點之間的最長路徑,這段路徑稱為「直徑」。 接...
原文題目 Given an integer array nums, find the subarray with the largest sum, and re...
原文題目 Given an integer array nums, return an array answer such that answer[i] is...
原文題目 Given an array nums of size n, return the majority element. The majority el...
原文題目 A trie (pronounced as "try") or prefix tree is a tree data struct...
原文題目 Write an efficient algorithm that searches for a value target in an m x n i...
原文題目 Given an m x n integer matrix matrix, if an element is 0, set its entire ro...
原文題目 You are given an n x n 2D matrix representing an image, rotate the image by...
Description Given a string s containing just the characters '(', ')', '{', '}',...
Description Given the head of a linked list, remove the nth node from the end of...
距今約兩個月前(2024.8.21),有位Reddit的網友利用Claude3.5 Sonnet進行LeetCode刷題,並用9美元在24小時內完成633道題目...
Description Given head, the head of a linked list, determine if the linked list...
🟨最長回文字子序列(解法1) 題目 本題取自 Leetcode 516. Longest Palindromic Subsequence Given a str...
原文題目 Given an array of integers temperatures represents the daily temperatures,...
原文題目 Given an encoded string, return its decoded string. The encoding rule is: k...
原文題目 Design a stack that supports push, pop, top, and retrieving the minimum ele...
🟨最長的共同子序列 本題取自 Leetcode 1143. Longest Common Subsequence 題目 Given two strings te...
Description You are given the heads of two sorted linked lists list1 and list2....
今天我們繼續看一題字串類型的題目:拆字。 🟨拆字 本題取自 Leetcode 139. Word Break 題目 Given a string s and a...
ꉂ(ˊᗜˋ*)嗨,我是wec,今天是DAY 11。 🔎 題目難度與描述 難度:MEDIUM 題目描述: 在圍成圓形的社區內且不觸發警報的前提下(不能偷相鄰的兩間...