LeetCode:876. Middle of the Linked List

Publish Date : 2020-07-08 23:19 題目: Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second middle node. 範例: Input: [1,2,3,4,5] Output: Node 3 from this list (Serialization: [3,4,5]) The returned node has value 3. (The judge's serialization of this node is [3,4,5]). Note that we returned a ListNode object

LeetCode:557. Reverse Words in a String III

Publish Date : 2020-05-20 17:19 題目: Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. 範例: Input: "Let's take LeetCode contest" Output: "s'teL ekat edoCteeL tsetnoc" 解法: 這題就是把句子的單字反過來 在這裡做stri

LeetCode:1337. The K Weakest Rows in a Matrix

Publish Date : 2020-05-19 15:18 題目: Given a m * n matrix mat of ones (representing soldiers) and zeros (representing civilians), return the indexes of the k weakest rows in the matrix ordered from the weakest to the strongest.A row i is weaker than row j, if the number of soldiers in row i is less than the number of soldiers in row j, or they have the

LeetCode:922. Sort Array By Parity II

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],

LeetCode:811. Subdomain Visit Count

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”

LeetCode: 944. Delete Columns to Make Sorted

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"],

Python3 PICkitSerialAnalyzer

Publish Date : 2020-04-24 17:20 工作上需要用到PICkitSerialAnalyzer GUI則是用Python3開發的… 而PICkitSerialAnalyzer

LeetCode: 700 Search in a Binary Search Tree

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:

LeetCode:933. Number of Recent Calls

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

LeetCode: 852. Peak Index in a Mountain Array

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] <