摘要:There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have direct prerequisites, for example, to take course 0 you 阅读全文
posted @ 2020-05-31 10:49 EnjoyingTheMoment 阅读(10) 评论(0) 推荐(0) 编辑
摘要:Given preorder and inorder traversal of a tree, construct the binary tree. You may assume that duplicates do not exist in the tree. Example Given in-o 阅读全文
posted @ 2020-05-28 02:25 EnjoyingTheMoment 阅读(8) 评论(0) 推荐(0) 编辑
摘要:Return the lexicographically smallest subsequence of text that contains all the distinct characters of text exactly once. Example 1: Input: "cdadabcc" 阅读全文
posted @ 2020-05-27 12:20 EnjoyingTheMoment 阅读(6) 评论(0) 推荐(0) 编辑
摘要:Given many words, words[i] has weight i. Design a class WordFilter that supports one function, WordFilter.f(String prefix, String suffix). It will ret 阅读全文
posted @ 2020-05-27 06:54 EnjoyingTheMoment 阅读(5) 评论(0) 推荐(0) 编辑
摘要:Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks. Tasks coul 阅读全文
posted @ 2020-05-27 03:13 EnjoyingTheMoment 阅读(3) 评论(0) 推荐(0) 编辑
摘要:Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. Example 1: Input: [0,1] Output: 2 Explanation: [0 阅读全文
posted @ 2020-05-26 22:23 EnjoyingTheMoment 阅读(11) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers and a number k, the majority number is the number that occurs more than 1/k of the size of the array, find all the majority 阅读全文
posted @ 2020-05-22 06:29 EnjoyingTheMoment 阅读(10) 评论(0) 推荐(0) 编辑
摘要:Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. Note: The algorithm should run in linear time and in O(1) spa 阅读全文
posted @ 2020-05-22 06:10 EnjoyingTheMoment 阅读(9) 评论(0) 推荐(0) 编辑
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文
posted @ 2020-05-22 04:53 EnjoyingTheMoment 阅读(10) 评论(0) 推荐(0) 编辑
摘要:Problem Link: Multiple of 2019 Key idea: For subarray S[i1, j] and S[i2, j] with i1 < i2, if the V[i1, j] % 2019 is the same with V[i2, k] % 2019, it 阅读全文
posted @ 2020-05-13 05:18 EnjoyingTheMoment 阅读(12) 评论(0) 推荐(0) 编辑