3.8k words 3 mins.

# Branch and Bound The branch-and-bound algorithm developed here is an improvement on the backtracking algorithm. The B&B design strategy is very similar to backtracking in that a state space tree is used to solve a problem. B&B vs. Backtracking B&B does not limit us to any...
2.1k words 2 mins.

⭐️ # 題目敘述 Given two 0-indexed integer arrays nums1 and nums2 , return a list answer of size 2 where: answer[0] is a list of all distinct integers in nums1 which are not present in nums2 . answer[1] is a list of all distinct integers in nums2 which are not present in nums1 . Note that the integers...
981 words 1 mins.

⭐️ # 題目敘述 There is a function signFunc(x) that returns: 1 if x is positive. -1 if x is negative. 0 if x is equal to 0 . You are given an integer array nums . Let product be the product of all values in the array nums . Return signFunc(product) . # Example 1 Input: nums =...
1.2k words 1 mins.

⭐️ # 題目敘述 You are given an array of unique integers salary where salary[i] is the salary of the ith employee. Return the average salary of employees excluding the minimum and maximum salary. Answers within 10-5 of the actual answer will be accepted. # Example 1 Input: salary =...
4.1k words 4 mins.

⭐️⭐️⭐️ # 題目敘述 Alice and Bob have an undirected graph of n nodes and three types of edges: Type 1: Can be traversed by Alice only. Type 2: Can be traversed by Bob only. Type 3: Can be traversed by both Alice and Bob. Given an array edges where edges[i] = [typei, ui, vi] represents a bidirectional...
1.4k words 1 mins.

Union-Find data structure 又稱 Disjoint-set data structure,用於處理不相交集合 (disjoint set) 的合併 (Union) 與查詢 (Find) 問題。 # Disjoint Set Disjoint set 表示數個 set 之間,擁有的元素都不相同,彼此互斥 (disjoint)。 可以去看看這篇文章 - disjoint set # Union Find Algorithm Union-Find Data Structure 是一種 forest 結構,forest 是一種 N-way Tree...
3.7k words 3 mins.

⭐️⭐️⭐️ # 題目敘述 Two strings X and Y are similar if we can swap two letters (in different positions) of X , so that it equals Y . Also two strings X and Y are similar if they are equal. For example, "tars" and "rats" are similar (swapping at positions 0 and 2), and...
857 words 1 mins.

⭐️⭐️ # 題目敘述 There are n bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s off or turning off if it’s on). For the ith round, you toggle every i bulb. For the nth round, you only...
4.4k words 4 mins.

# Example of SIC Program ,X modifier: indexed addressing mode (Line 160, 225) Lines beginning with . contain comments only (Line 110~120, 195~205) # COPY Subroutine 相當於整個程式的主函式 因為 FIRST 包含在此 Subroutine 中 用來把 input device 的檔案複製到 output device 透過 RDREC 讀取檔案中的 record 並存到 buffer 透過 WRREC 把 buffer...
2.7k words 2 mins.

⭐️ # 題目連結 ZeroJudge 題目連結 Online Judge uDebug # 題目敘述 A friend of you has just bought a new computer. Until now, the most powerful computer he ever used has been a pocket calculator. Now, looking at his new computer, he is a bit disappointed, because he liked the LC-display of his calculator so...