696 1 分鐘

⭐️ # 題目敘述 Write a function that reverses a string. The input string is given as an array of characters s . You must do this by modifying the input array in-place with O(1) extra memory. # Example 1 Input: s =...
702 1 分鐘

⭐️ # 題目敘述 You are given a string s . The score of a string is defined as the sum of the absolute difference between the ASCII values of adjacent characters. Return the score of s . # Example 1 Input: s = "hello" Output: 13 Explanation: The ASCII values of the characters in s are:...
1.1k 1 分鐘

⭐️⭐️⭐️ # 題目敘述 Given an integer array nums , in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in any order. You must write an algorithm that runs in linear runtime complexity and uses...
1k 1 分鐘

⭐️⭐️⭐️ # 題目敘述 Given an array of integers arr . We want to select three indices i , j and k where (0 <= i < j <= k < arr.length) . Let's define a and b as follows: a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1] b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k] Note that ^ denotes...
1k 1 分鐘

⭐️⭐️ # 題目敘述 Given the binary representation of an integer as a string s , return the number of steps to reduce it to 1 under the following rules: If the current number is even, you have to divide it by 2 . If the current number is odd, you have to add 1 to it. It is guaranteed that you can always...
1.3k 1 分鐘

⭐️⭐️ # 題目敘述 You are given two strings s and t of the same length and an integer maxCost . You want to change s to t . Changing the ith character of s to ith character of t costs |s[i] - t[i]| (i.e., the absolute difference between the ASCII values of the characters). Return the maximum length of a...
1k 1 分鐘

⭐️ # 題目敘述 You are given an array nums of non-negative integers. nums is considered special if there exists a number x such that there are exactly x numbers in nums that are greater than or equal to x . Notice that x does not have to be an element in nums . Return x if the array is special,...
626 1 分鐘

# 安裝 anaconda 前往 anaconda 網站進行下載 下載後會得到一個 `` 利用 bash [下載檔案名稱.sh] 開始安裝,接著按下 Enter 會有一段授權條款,可以用上下鍵看內容 接著會問你是否同意,輸入 yes 接著確認安裝位置,按下 Enter 接著安裝好後,記得重新開機 電腦重開後,終端機提示命令符會看到 (base) 在前面 可以利用 conda deactivate 退出 conda 環境 可以輸入以下指令,停用自動進入 conda 環境 conda config --set auto_activate_base false # 查看 conda...
818 1 分鐘

🌕🌗🌑🌑🌑 # 題目連結 題目連結 Online Judge uDebug # 題目說明 Time limit: 3.000 seconds # 題目 Given a line of text you will have to find out the frequencies of the ASCII characters present in it. The given lines will contain none of the first 32 or last 128 ASCII characters. Of course lines may end with \n and...
2.2k 2 分鐘

🌕🌗🌑🌑🌑 # 題目連結 題目連結 Online Judge uDebug # 題目說明 Time limit: 3.000 seconds # 題目 This is year 2200AD. Science has progressed a lot in two hundred years. Two hundred years is mentioned here because this problem is being sent back to 2000AD with the help of time machine. Now it is possible to...