1.8k 2 分鐘

⭐️⭐️⭐️ # 題目敘述 You are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi] . The cost of connecting two points [xi, yi] and [xj, yj] is the manhattan distance between them: |xi - xj| + |yi - yj| , where |val| denotes the absolute value of...
2.9k 3 分鐘

🌕🌗🌑🌑🌑 # 題目連結 題目連結 Online Judge uDebug # 題目說明 Time limit: 3.000 seconds # 題目 With the advent of high speed graphics workstations, CAD (computer-aided design) and other areas (CAM, VLSI design) have made increasingly effective use of computers. One of the problems with drawing images is the...
2.6k 2 分鐘

🌕🌑🌑🌑🌑 # 題目連結 題目連結 Online Judge uDebug # 題目說明 Time limit: 3.000 seconds # 題目 Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is...
1.8k 2 分鐘

⭐️⭐️⭐️ # 題目敘述 There are n people that are split into some unknown number of groups. Each person is labeled with a unique ID from 0 to n - 1 . You are given an integer array groupSizes , where groupSizes[i] is the size of the group that person i is in. For example, if groupSizes[1] = 3 , then person...
1.5k 1 分鐘

⭐️⭐️⭐️⭐️⭐️ # 題目敘述 A frog is crossing a river. The river is divided into some number of units, and at each unit, there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water. Given a list of stones ' positions (in units) in sorted ascending order,...
1.1k 1 分鐘

⭐️⭐️⭐️⭐️ # 題目敘述 Given an m x n binary matrix mat , return the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1 . # Example 1 Input: mat = [[0,0,0],[0,1,0],[0,0,0]] Output: [[0,0,0],[0,1,0],[0,0,0]] # Example 2 Input: mat = [[0,0,0],[0,1,0],[1,1,1]] Output:...
1.5k 1 分鐘

⭐️⭐️⭐️⭐️⭐️ # 題目敘述 You are given an array of integers nums , there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. Return the max sliding window. #...
1.5k 1 分鐘

⭐️⭐️ # 文法摘要 主詞是第三人稱單數 (he, she, it) 且為現在式,使用的動詞字尾上必須加 "-s" 或 "-es",規則如下: 動詞規則改法 範例 動詞字尾加上 s hit - hits 動詞結尾是 e,加上 s hide - hides 動詞字尾是 s/o/x/z/ch/sh,加上 es catch - catches 動詞字尾為 「母音 + y」,只要加 s stay - stays 動詞字尾為 「子音 + y」,要去 y 加上 ies study -...
1.3k 1 分鐘

⭐️⭐️⭐️ # 題目敘述 Given the head of a linked list and a value x , partition it such that all nodes less than x come before nodes greater than or equal to x . You should preserve the original relative order of the nodes in each of the two partitions. # Example 1 Input: head = [1,4,3,2,5,2], x =...
1.1k 1 分鐘

⭐️⭐️ # 題目敘述 Given an integer array nums and an integer k , return the kth largest element in the array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Can you solve it without sorting? # Example 1 Input: nums = [3,2,1,5,6,4], k = 2 Output: 5 # Example...