iT邦幫忙

algorithm相關文章
共有 318 則文章
鐵人賽 自我挑戰組 DAY 24
LeetCode Top 100 Liked 系列 第 24

技術 [Day 24] Search in Rotated Sorted Array (Medium)

33. Search in Rotated Sorted Array Question There is an integer array nums sorte...

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

技術 [Day 23] Remove Nth Node From End of List (Medium)

19. Remove Nth Node From End of List Question Given the head of a linked list, r...

LeetCode Top 100 Liked 系列 第 37

技術 [Day 37] Jump Game (Medium)

55. Jump Game Solution 1: DP (Tail -> Head) class Solution: def canJump(s...

LeetCode Top 100 Liked 系列 第 55

技術 [Day 54 - 2] Construct Binary Tree from Preorder and Inorder Traversal (Medium)

105. Construct Binary Tree from Preorder and Inorder Traversal Solution 1: Recur...

LeetCode Top 100 Liked 系列 第 34

技術 [Day 34] Find the Duplicate Number (Medium)

287. Find the Duplicate Number Solution 1: Brute-Force (TLE) class Solution:...

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

技術 [Day 14] Merge Two Sorted Lists (Easy)

21. Merge Two Sorted Lists Question You are given the heads of two sorted linked...

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

技術 [Day 02] Longest Substring Without Repeating Characters (Medium)、Median of Two Sorted Arrays (Hard)

3. Longest Substring Without Repeating Characters (Medium) Question Given a stri...

LeetCode Top 100 Liked 系列 第 31

技術 [Day 31] Letter Combinations of a Phone Number (Medium)

17. Letter Combinations of a Phone Number Solution 1: Recursive + DFS class Solu...

LeetCode Top 100 Liked 系列 第 58

技術 [Day 57] Linked List Cycle II (Medium)

142. Linked List Cycle II Solution 1: HashSet class Solution: def detectCycl...

LeetCode Top 100 Liked 系列 第 77

技術 [Day 72 ] Remove Element (Easy)

27. Remove Element Solution 1: Two Pointer + Swap class Solution: def remove...

LeetCode Top 100 Liked 系列 第 63

技術 [Day 61 - 2] Unique Paths (Medium)

62. Unique Paths Solution 1: DFS (TLE) class Solution: def uniquePaths(self,...

鐵人賽 Software Development DAY 18

技術 Day 17 切出去合進來 升職發大財 - Merge Sort

Merge Sort 是一種透過切分資料再一一合併的排序演算法。 Merge Sort 有使用到 Divide and Conquer 與 Recursion...

LeetCode Top 100 Liked 系列 第 61

技術 [Day 60 ] Majority Element (Easy)

169. Majority Element Solution 1: Counter from collections import Counter class...

鐵人賽 Software Development DAY 27

技術 Day 26 展現解題 GAP - Heap Sort

Heap Sort 使用 Binary Heap 處理資料排序,也可視為 Selection Sort 的改良版。 兩者一樣都是將資料分成兩區,一區為排序好的,...

LeetCode Top 100 Liked 系列 第 62

技術 [Day 61 - 1] Palindrome Linked List (Easy)

234. Palindrome Linked List Solution 1: Auxiliary array & reversed class Sol...

LeetCode Top 100 Liked 系列 第 44

技術 [Day 44] Lowest Common Ancestor of a Binary Tree (Medium)

236. Lowest Common Ancestor of a Binary Tree Solution 1: DFS class Solution:...

LeetCode Top 100 Liked 系列 第 39

技術 [Day 39] Number of Islands (Medium)

200. Number of Islands Solution 1: DFS + Bitmap class Solution: def numIslan...

LeetCode Top 100 Liked 系列 第 56

技術 [Day 55] Find First and Last Position of Element in Sorted Array (Medium)

34. Find First and Last Position of Element in Sorted Array Solution 1: Recursiv...

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

技術 [Day 21] Palindrome Number (Easy)

9. Palindrome Number Question Given an integer x, return true if x is palindrome...

LeetCode Top 100 Liked 系列 第 45

技術 [Day 45] Reverse Nodes in k-Group (Hard)

25. Reverse Nodes in k-Group Solution 1: Iterative class Solution: def rever...

鐵人賽 Kotlin DAY 19
Kotlin is all you need 系列 第 19

技術 [Day 19] Dynamic Programming — Coin Change Problem / Rod Cutting Problem

Coin Change Problem 如何以最少的硬幣數量來湊出特定金額的錢。 這個問題可以用簡單的方式描述如下: 假設我們有一些不同面額的硬幣,每種面額的硬...

鐵人賽 Software Development DAY 21

技術 Day 20 你會分類你要先講 - Bucket Sort

Bucket Sort 和之前的 Radix Sort 有點類似,建立幾個桶子並將資料丟進去排序。而 Bucket Sort 是取區間,例如 1 號桶子裝 0...

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

技術 [Day 19] Longest Common Prefix (Easy)

14. Longest Common Prefix Question Write a function to find the longest common p...

LeetCode Top 100 Liked 系列 第 42

技術 [Day 42] Unique Binary Search Trees (Medium)

96. Unique Binary Search Trees Solution 1: DP class Solution: def numTrees(s...

鐵人賽 Software Development DAY 8

技術 Day 7 BO5-4 - Divide and Conquer

將一組資料切分成兩組或多組資料,再用切分後的資料進行處理。此技巧能有效減少時間複雜度。 此技巧大量用於搜尋演算法內,以下用 二分搜尋法 (Binary Sear...

LeetCode Top 100 Liked 系列 第 47

技術 [Day 47] Maximum Product Subarray (Medium)

152. Maximum Product Subarray Solution 1: DP class Solution: def maxProduct(...

鐵人賽 Software Development DAY 13

技術 Day 12 我的回合,抽卡!!! - Insertion Sort

從第二個元素開始,往前比對,如果比前一個元素小,則交換位置,以此類推。 以 [30, 5, 1, 31, 10, 9, 2, 3, 4, 8, 7, 6] 來說...

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

技術 [Day 17] Best Time to Buy and Sell Stock (Easy)

121. Best Time to Buy and Sell Stock Question You are given an array prices wher...

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

技術 [Day 20] House Robber (Medium)

198. House Robber Question You are a professional robber planning to rob houses...

鐵人賽 Kotlin DAY 1
Kotlin is all you need 系列 第 1

技術 [Day 1] Why Kotlin ?

開賽前言 以前都有想過用一種程式語言實作基本演算法,之前試過 C++ 和 Python,不過寫幾天後就沒碰了 :) 這次是透過 Kotlin ~ 以前在 Mo...