原创 LeetCode 819. Most Common Word

題目: Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words

原创 亞麻OA2 Substrings of size K with K distinct chars

題目: Given a string s and an int k, return all unique substrings of s of size k with k distinct characters. Example 1:

原创 LeetCode 170. Two Sum III - Data structure design

題目: Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number

原创 LeetCode 1099. Two Sum Less Than K

題目: Given an array A of integers and integer K, return the maximum S such that there exists i < j with A[i] + A[j] = S 

原创 LeetCode 937. Reorder Data in Log Files

題目: You have an array of logs.  Each log is a space delimited string of words. For each log, the first word in each log

原创 LeetCode 701. Insert into a Binary Search Tree

題目: Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into t

原创 Java Collections中各種數據結構的使用總結

學了683以後才感覺真正體會到了Java中數據結構的選擇的奧祕,加上最近ds的project在design的過程中也要精心挑選數據結構,所以就在實踐中學習了。但感覺每次都用完就忘,所以還是來總結一下吧。 零、Vector class(ht

原创 LeetCode 259. 3Sum Smaller

題目: Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 <= i < j < k < n t

原创 LeetCode 16. 3Sum Closest

題目: Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest t

原创 LeetCode 23. Merge k Sorted Lists

題目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: Input:

原创 LeetCode 572. Subtree of Another Tree

題目: Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with

原创 LeetCode 239. Sliding Window Maximum

題目: Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the ver

原创 LeetCode 140. Word Break II

題目: Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to const

原创 LeetCode 103. Binary Tree Zigzag Level Order Traversal

題目: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then ri

原创 LeetCode 3. Longest Substring Without Repeating Characters

題目: Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb