iT邦幫忙

leetcode相關文章
共有 1104 則文章

技術 Leetcode (Algorithm I): 5. Search Insert Position

思路 也是binary search的應用題,承前兩篇文章,有lb跟ub和index三個數值可選,我目前覺得應該是回傳lower bound值。    程式 c...

技術 leetcode with python:367. Valid Perfect Square

題目: Given a positive integer num, write a function which returns True if num is...

鐵人賽 自我挑戰組 DAY 29

技術 Day 29 Find First and Last Position of Element in Sorted Array

題目說明:給一個非遞減的矩陣(意即陣列當中第i+1個元素數值必>=第i個元素數值)和一個給定的目標值,要你求出該目標值第一次出現和最後一次出現的位置。如果...

LeetCode Top 100 Liked 系列 第 35

技術 [Day 35] 122. Best Time to Buy and Sell Stock II (Medium)

122. Best Time to Buy and Sell Stock II Solution 1: DP Time Complexity: O(N)Spa...

鐵人賽 Software Development DAY 20

技術 Day 20:不需要提示的兩人:326、342、125

「夏天姐!我們兩個來囉!」菁菁跟曉欣一起進來丹提咖啡,開心地打招呼 「兩位感情越來越好了!」夏天開心的打開兩題題目: 326. Power of Three、...

技術 [8/2] 2134. Minimum Swaps to Group All 1's Together II

MediumRelated Topics: Array / Sliding WindowLeetCode Source 解題想法 我們首先遍歷數組來計算1的...

鐵人賽 Software Development DAY 29

技術 Day 29:等待面試結果的一天:371、704、2331

「菁菁!!」曉欣難得看起來特別開心 「怎麼了怎麼了?」 「最近雪倫姐給我介紹的其他面試,上機考的時候,我一下就寫完了!」「這麼厲害!」「對呀!超級開心的」 「面...

技術 30天Leetcode挑戰(2):341 Flatten Nested List Iterator

碎碎念 寫完之後發現我好多function根本不會,但反正看著其他人的範例也是加減學 題幹 會有一個list裡面可能有很多list,要把它們變成只有一層,也就是...

技術 [LeetCode] 122. Best Time to Buy and Sell Stock II

MediumRelated Topics: Array / Dynamic Programming / GreedyLeetCode Source 解題想法...

鐵人賽 自我挑戰組 DAY 29

技術 Day 29 - Array and String - Conslusion Problem

189. Rotate Array 題目 Given an integer array nums, rotate the array to the right...

鐵人賽 Mobile Development DAY 23

技術 Day 23 - 724. Find Pivot Index - 解法與複雜度分析 - LeetCode in Swift

基本資訊 難度: Easy 網址: https://leetcode.com/problems/find-pivot-index/ 資料結構與演算法...

鐵人賽 自我挑戰組 DAY 8

技術 Day 8 Symmetric Tree

題目說明:給你兩棵樹,要你判斷兩棵樹是否對稱 Case 1Input: root = [1,2,2,3,4,4,3]Output: true Case 2Inp...

鐵人賽 Mobile Development DAY 20

技術 Day 20 - 543. Diameter of Binary Tree - 解法與複雜度分析 - LeetCode in Swift

基本資訊 難度: Easy 網址: https://leetcode.com/problems/diameter-of-binary-tree/ 題意...

技術 [8/8] 885. Spiral Matrix III

MediumRelated Topics: Array / Matrix / SimulationLeetCode Source 解題想法 首先設定每次尋訪...

技術 30天Leetcode挑戰(9):1220. Count Vowels Permutation

碎碎念 AI已經強大到我覺得「他已經知道我在刷leetcode」了......可能我問問題的時候直接讓他知道我是要看母音吧 是說,我很想知道到底是誰在看我的文章...

鐵人賽 Mobile Development DAY 3

技術 Day 3 - 121. Best Time to Buy and Sell Stock - 解法與複雜度 - LeetCode in Swift

繼第二天的「160. Intersection of Two Linked Lists」,今天來解 121 這題!還沒看過第二天或再之前天數的朋友,歡迎也去看...

技術 [leetcode - Bliend-75 ] 213. House Robber II (Medium)

You are a professional robber planning to rob houses along a street. Each house...

鐵人賽 Software Development DAY 9

技術 Day09: 極端測試

後來我才知道,還有更短的解法,終究是錯付了。 時代在進步,程式語言在簡化。 class Solution { fun numJewelsInStones...

鐵人賽 Software Development DAY 15

技術 Day15: 陣列對應轉換map方法

今晚最後一題的2315. Count Asterisks,也是split和陣列的應用,要求計算在每個配對|之外的星號數量。 字串陣列的方法在1.3支援的比較弱,...

鐵人賽 Software Development DAY 21

技術 Day21: 乖乖排隊的Stack和Queue

「唉,晚上來看Stack和Queue的題目吧。」我看了看剩下的tags,做出了決定。 「學姊為啥嘆氣啊。」學妹端起冒著煙的拉麵,嚥下一口熱湯後露出幸福的表情。...

技術 30天Leetcode挑戰(11):501 Fine mode in binary tree

碎碎念 好像斷更了,但沒關係,跟我一起挑戰的朋友有持續下去的樣子。今天也是一個跟閱讀測驗鬥智鬥勇的題目,而且最後搞出來的程式碼大概40行你真的是easy題目嗎....

正拳的 Leetcode 150 系列 第 5

技術 [Day 5] 善用 Python 的 collections - deque

昨天我們講到 collections 模組,今天我們來介紹 collections 模組中的 deque:double-ended queue,也就是雙端佇列。...

鐵人賽 Software Development DAY 24

技術 Day 24:自主學習 leetcode 帶來順利的一天:2114、2011、2160、1920

「兩位這幾天,又解了哪些題目呀?」 學著讓曉欣和菁菁自己找題目之後,夏天變得輕鬆很多,只需要幫忙看一下兩人解題的答案即可。 曉欣和菁菁也很老實的努力寫 leet...

鐵人賽 自我挑戰組 DAY 26
LeetCode Top 100 Liked 系列 第 26

技術 [Day 26] Symmetric Tree (Easy)

101. Symmetric Tree Question Given the root of a binary tree, check whether it i...

鐵人賽 自我挑戰組 DAY 25
LeetCode Top 100 Liked 系列 第 25

技術 [Day 25] Permutations (Medium)

46. Permutations Question Given an array nums of distinct integers, return all t...

技術 leetcode with python:136. Single Number

題目: Given a non-empty array of integers nums, every element appears twice excep...

鐵人賽 自我挑戰組 DAY 7
LeetCode Top 100 Liked 系列 第 7

技術 [Day 07] Trapping Rain Water (Hard)

42. Trapping Rain Water Question Given n non-negative integers representing an e...

技術 Day29 X Leetcode:最小棧 Min Stack

前言 嘿嘿~今天我們要來挑戰一個有趣的設計題目!你是否曾經想過,要設計一個特別的堆疊,不僅能執行一般的 push 和 pop 操作,還能在 O(1) 時間內快...

鐵人賽 自我挑戰組 DAY 22

技術 [Day 22] LeetCode 75 - 62. Unique Paths

LeetCode 75 Level 1 - Day 11 Dynamic Programming 62. Unique Paths 題目連結 難易度:Me...

技術 leetcode with python:9. Palindrome Number

題目: Given an integer x, return true if x is palindrome integer.An integer is a...