🟨編輯距離 本題取自 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 題目描述: 在圍成圓形的社區內且不觸發警報的前提下(不能偷相鄰的兩間...
Description Given the head of a singly linked list, reverse the list, and return...
٩(◕‿◕。)۶嗨,我是wec,今天是DAY 10。 🔎 題目難度與描述難度:MEDIUM題目描述:給定一個代表房屋的非負整數數組,每個房子裡有一定的金錢,搶匪...
今天我們來看一個字串類的經典題型:最長回文子字串(LPS) 題目:🟨最長回文子字串(LPS) 本題取自 Leetcode 5. Longest Palindro...
Description Given an integer array nums sorted in non-decreasing order, remove t...
٩(๑•̀ω•́๑)و嗨,我是wec,今天是DAY 9。 🔎 題目難度與描述 難度:MEDIUM 題目描述: 給定一個網格,每個格子都有一個非負數字,從左上角走...
🟨最大正方形 本題取自 Leetcode 221. Maximal Square 題目 Given an m x n binary matrix filled...
(๑>◡<๑)ノ嗨,我是wec,今天是DAY 8。 🔎 題目難度與描述 難度:MEDIUM 題目描述: 有一個排序過的數組被從某個位置旋轉了,比如[...
🟨三角形 本題取自 Leetcode 120. Triangle 題目 Given a triangle array, return the minimum p...
Description Write a function to find the longest common prefix string amongst an...