⭐️ # 題目敘述 Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf is a node with no children. # Example 1 Input: root = [3,9,20,null,null,15,7] Output: 2 # Example 2 Input: root =...
⭐️⭐️⭐️ # 題目敘述 A teacher is writing a test with n true/false questions, with 'T' denoting true and 'F' denoting false. He wants to confuse the students by maximizing the number of consecutive questions with the same answer (multiple trues or multiple falses in a row). You are given a...
⭐️⭐️⭐️ # 題目敘述 Given a binary array nums , you should delete one element from it. Return the size of the longest non-empty subarray containing only 1 's in the resulting array. Return 0 if there is no such subarray. # Example 1 Input: nums = [1,1,0,1] Output: 3 Explanation: After deleting the...
⭐️⭐️⭐️ # 題目敘述 Given an integer array nums where every element appears three times except for one, which appears exactly once. Find the single element and return it. You must implement a solution with a linear runtime complexity and use only constant extra space. # Example 1 Input: nums =...
⭐️ # 題目敘述 Given two strings s and goal , return true if you can swap two letters in s so the result is equal to goal , otherwise, return false . Swapping letters is defined as taking two indices i and j (0-indexed) such that i != j and swapping the characters at s[i] and s[j] . For example,...
ChienI Kao 筆記網站 JHTNT 筆記網站 # Text Interpolation Using the "Mustache" syntax (double curly braces 兩個大括號 {{ }} ) <p> {{ value }} </p>But Mustaches cannot be used inside HTML attributes. #...