iT邦幫忙

algorithm相關文章
共有 358 則文章
鐵人賽 Software Development DAY 23

技術 Day 22 這篇若...不看...財哥也...感嘆... - Tree Traversal

由於樹狀結構並不像 Lined List 或陣列那樣是線狀的,故需要遍歷整個樹狀結構是很複雜的,而且有多種方式。 大致上分為以下兩種: Breadth-fir...

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

技術 [Day 22] LRU Cache (Medium)

146. LRU Cache Question Design a data structure that follows the constraints of...

鐵人賽 Software Development DAY 21

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

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

鐵人賽 自我挑戰組 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...

鐵人賽 Software Development DAY 20

技術 Day 19 排序新理解 - Radix Sort

在這篇之前的排序法都可以用在任何可以比較的資料上,例如一個含有帳戶資料的陣列,按照每個帳戶的 ID 、更新時間、名字、帳戶餘額等等來排序。但 Radix Sor...

鐵人賽 自我挑戰組 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...

鐵人賽 自我挑戰組 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...

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

技術 [Day 18] Edit Distance (Hard)

72. Edit Distance Question Given two strings word1 and word2, return the minimum...

鐵人賽 自我挑戰組 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...

LeetCode Top 100 Liked 系列 第 71 篇

技術 [Day 67 - 2] Swap Nodes in Pairs (Medium)

24. Swap Nodes in Pairs Solution 1: Recursive class Solution: def swapPairs(...

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

技術 [Day 16] Longest Increasing Subsequence (Medium)

300. Longest Increasing Subsequence Question Given an integer array nums, return...

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

技術 [Day 15] Climbing Stairs (Easy)

70. Climbing Stairs Question You are climbing a staircase. It takes n steps to r...

鐵人賽 Software Development DAY 19

技術 Day 18 快還要更快 - Quick Sort

Quick Sort 使用基準值 (pivot) 比對排序,並透過 Recursion 的技巧,不斷將每個元素放到正確的位置上。 第一步是從陣列中取出一個數字當...

鐵人賽 Software Development DAY 18

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

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

鐵人賽 自我挑戰組 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 13
LeetCode Top 100 Liked 系列 第 13 篇

技術 [Day 13] 206. Reverse Linked List (Easy)

206. Reverse Linked List Question Given the head of a singly linked list, revers...

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

技術 [Day 12] Generate Parentheses (Medium)

22. Generate Parentheses Question Given n pairs of parentheses, write a function...

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

技術 [Day 11] 136. Single Number (Easy)

136. Single Number Question Given a non-empty array of integers nums, every elem...

鐵人賽 Software Development DAY 13

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

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

鐵人賽 Software Development DAY 12

技術 Day 11 選我選我選我選我 - Selection Sort

Selection Sort 實作上是遍歷一次陣列,找出最小值,並將最小值與陣列的第一個值交換,以此類推,再遍歷一次陣列 (先前排序好的位置可以略過) 找出最小...

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

技術 [Day 10] Remove Duplicates from Sorted Array (Easy)

26. Remove Duplicates from Sorted Array Question Given an integer array nums sor...

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

技術 [Day 09] Regular Expression Matching (Hard)

10. Regular Expression Matching Question Given an input string s and a pattern p...

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

技術 [Day 08] Valid Parentheses (Easy)

20. Valid Parentheses Question Given a string s containing just the characters '...

鐵人賽 自我挑戰組 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...

鐵人賽 Software Development DAY 10

技術 Day 9 絕命雙排 - Linear Search & Binary Search

Linear Search Linear Search 非常常見,甚至在學迴圈時就已經用過了。以下直接給範例練習! Practice - Linear Sear...

鐵人賽 Software Development DAY 9

技術 Day 8 BO5-5 - Recursion

Recursion 的定義是一個會呼叫自己的函式。 Recursion 技巧在很多地方都有用到,例如: JSON.stringify & JSON....

鐵人賽 Software Development DAY 8

技術 Day 7 BO5-4 - Divide and Conquer

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

鐵人賽 Software Development DAY 7

技術 Day 6 BO5-3 - Sliding Window

Sliding Window 跟上篇 Multiple Pointers 類似,定義兩個指標,一個是 start,一個是 end。 像是: start...

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

技術 [Day 06] Container With Most Water (Medium)

11. Container With Most Water Question You are given an integer array height of...

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

技術 [Day 05] Maximum Subarray (Easy)、Reverse Integer (Easy)

53. Maximum Subarray Question Given an integer array nums, find the contiguous s...