iT邦幫忙

algorithm相關文章
共有 318 則文章
鐵人賽 Software Development DAY 18

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

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

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

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

鐵人賽 Software Development DAY 13

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

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

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

技術 [Day 12] Generate Parentheses (Medium)

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

鐵人賽 Software Development DAY 12

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

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

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

技術 Day 10 還敢下來啊 - Bubble Sort

一種排序資料的方式,實務上不太常使用,除了某些特定情境。相對於其他排序方式,Bubble 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...

鐵人賽 Software Development DAY 10

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

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

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

鐵人賽 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...

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

鐵人賽 Software Development DAY 6

技術 Day 5 BO5-2 - Multiple Pointers

Multiple Pointers 技巧是透過建立 pointer 變數代表目前指到哪個位置 (index)。使用兩個 pointer 代表目前查找的位置與範圍...

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

鐵人賽 Software Development DAY 5

技術 Day 4 BO5-1 - Frequency Counter

Frequency Counter 是一種解題技巧,它使用物件的鍵值 (Key) 來記錄陣列或字串裡面特定值的出現次數。它可以避免一直遍歷資料,可以有效減少時間...

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

技術 [Day 04] 3Sum (Medium)

15. 3Sum Question Given an integer array nums, return all the triplets [nums[i],...

鐵人賽 Software Development DAY 3

技術 Day 2 哎呀這什麼水平 - 時間與空間複雜度

在 Day 1 我們講到的複雜度表示都是指時間複雜度,在輸入的參數越多越大的情況下,所要執行的步驟(執行所需花費的時間)的增長趨勢。 我們也可以使用 Big O...

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

技術 [Day 03] Longest Palindromic Substring (Medium)

5. Longest Palindromic Substring Question Given a string s, return the longest p...

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

鐵人賽 Software Development DAY 2

技術 Day 1 這到底是什麼符號喔齁齁齁齁齁 - Big O Notation

Big O Notation 是一種表示演算法複雜度的方式。同樣解決一個演算法問題,若該算法執行的時間越少,使用的記憶體愈少,就是越好的解法。可以用來評斷該演算...

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

技術 [Day 01] Two Sum (Easy)、Add Two Numbers (Medium)

1. Two Sum (Easy) Question Given an array of integers nums and an integer target...

鐵人賽 Software Development DAY 1

技術 Day 0 歡迎來到刷題峽谷 - Algorithms & Data Structures

本系列將使用 JavaScript 來撰寫程式,文中也會穿插英文讓讀者盡量熟悉這些單詞,未來在看相關題目時能夠幫助理解。 什麼是演算法與資料結構 演算法指...