Publish Date : 2020-05-18 15:30 題目: Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even. Sort the array so that whenever A[i] is odd, i is odd; and whenever A[i] is even, i is even. You may return any answer array that satisfies this condition. 範例: Input: [4,2,5,7] Output: [4,5,2,7] Explanation: [4,7,2,5], [2,5,4,7],
Publish Date : 2020-05-12 10:36 問題: A website domain like “discuss.leetcode.com” consists of various subdomains. At the top level, we have “com”, at the next level, we have “leetcode.com”
Publish Date : 2020-05-12 10:32 題目: We are given an array A of N lowercase letter strings, all of the same length. Now, we may choose any set of deletion indices, and for each string, we delete all the characters in those indices. For example, if we have an array A = ["abcdef","uvwxyz"] and deletion indices {0, 2, 3}, then the final array after deletions is ["bef", "vyz"],
Publish Date : 2020-04-24 17:20 工作上需要用到PICkitSerialAnalyzer GUI則是用Python3開發的… 而PICkitSerialAnalyzer
Publish Date : 2020-03-18 15:34 題目: Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node’s value equals the given value. Return the subtree rooted with that node. If such node doesn’t exist, you should return NULL. For example, Given the tree:
Publish Date : 2020-03-17 14:22 題目: Write a class RecentCounter to count recent requests. It has only one method: ping(int t), where t represents some time in milliseconds. Return the number of pings that have been made from 3000 milliseconds ago until now. Any ping with time in [t - 3000, t] will count, including the current ping. It is guaranteed that every call to ping uses a
Publish Date : 2020-03-13 09:58 題目: Let’s call an array A a mountain if the following properties hold: A.length >= 3 There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.length - 1] Given an array that is definitely a mountain, return any i such that A[0] <
Publish Date : 2020-03-03 16:54 題目: Given a string S that only contains “I” (increase) or “D” (decrease), let N = S.length. Return any permutation A of [0, 1, ..., N] such that for all i = 0, ..., N-1: * If S[i] == "I", then A[i] < A[i+1] * If S[i] == "D", then A[i] > A[i+1] 範例: Input: "IDID" Output:
Publish Date : 2020-03-02 13:28 題目: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. 範例: Input: x = 1, y = 4Output: 2Explanation:1 (0 0 0 1)4 (0 1 0 0) ↑ ↑The above arrows point to positions where the corresponding bits are
Publish Date : 2020-02-24 14:10 題目: Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order. 範例: Input: [-4,-1,0,3,10]Output: [0,1,9,16,100] Input: [-7,-3,2,3,11]Output: [4,9,9,49,121] 在LeetCode中使用Golang的庫很方便 不用impo