889 1 分鐘

⭐️⭐️⭐️ # 題目敘述 Given an array of integers arr, find the sum of min(b) , where b ranges over every (contiguous) subarray of arr . Since the answer may be large, return the answer modulo 10^9 + 7 . # Example 1 Input: arr = [3,1,2,4] Output: 17 Explanation: Subarrays are [3], [1], [2], [4], [3,1],...
1.6k 1 分鐘

⭐️⭐️⭐️ # 題目敘述 Given an n x n array of integers matrix , return the minimum sum of any falling path through matrix . A falling path starts at any element in the first row and chooses the element in the next row that is either directly below or diagonally left/right. Specifically, the next element...
1k 1 分鐘

⭐️ # 題目敘述 You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? # Example 1 Input: n = 2 Output: 2 Explanation: There are two ways to climb to the top. 1 step + 1 step 2 steps # Example...
2.3k 2 分鐘

⭐️⭐️⭐️ # 題目敘述 Implement the RandomizedSet class: RandomizedSet() Initializes the RandomizedSet object. bool insert(int val) Inserts an item val into the set if not present. Returns true if the item was not present, false otherwise. bool remove(int val) Removes an item val from the set if present....
1.9k 2 分鐘

⭐️⭐️⭐️ # 題目敘述 You are given an integer array matches where matches[i] = [winneri, loseri] indicates that the player winneri defeated player loseri in a match. Return a list answer of size 2 where: answer[0] is a list of all players that have not lost any matches. answer[1] is a list of all players...
1.7k 2 分鐘

⭐️⭐️⭐️ # 題目敘述 Two strings are considered close if you can attain one from the other using the following operations: Operation 1: Swap any two existing characters. For example, abcde -> aecdb Operation 2: Transform every occurrence of one existing character into another existing character,...
1k 1 分鐘

⭐️⭐️⭐️ # 題目敘述 You are given two strings of the same length s and t . In one step you can choose any character of t and replace it with another character. Return the minimum number of steps to make t an anagram of s . An Anagram of a string is a string that contains the same characters with a...
1.2k 1 分鐘

ChienI Kao 筆記網站 JHTNT 筆記網站 # What is AI? 能夠如同人類進行智慧處理的技術、機器 # 人工智能認知狀態 強人工智慧: 可能擁有人類的自我意識,具有超越人類的可能性 弱人工智慧: 可能會取代部分的人類能力,但沒辦法取代全部 # 人工智慧發展階段 機器學習: 進行適當的處理,就可以根據輸入資料預測數值、最佳化。 深度學習: 輸入資料不經過處理,讓電腦自己擷取特徵,來獲取最後的結果。 # 機器學習 Machine Learning 讓電腦有更高的辨識程度,需要決定要依據哪個基準 (參數) 運作。 機器學習能夠根據輸入資料,自動決定 (學習)...
972 1 分鐘

⭐️ # 題目敘述 You are given a string s of even length. Split this string into two halves of equal lengths, and let a be the first half and b be the second half. Two strings are alike if they have the same number of vowels ( 'a' , 'e' , 'i' , 'o' , 'u' ,...
1.8k 2 分鐘

⭐️⭐️⭐️ # 題目敘述 Given the root of a binary tree, find the maximum value v for which there exist different nodes a and b where v = |a.val - b.val| and a is an ancestor of b . A node a is an ancestor of b if either: any child of a is equal to b or any child of a is an ancestor of b . # Example 1 Input:...