随笔分类 - LeetCode
摘要:Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step: Copy All: You can copy all the
阅读全文
摘要:In the world of Dota2, there are two parties: the Radiant and the Dire. The Dota2 senate consists of senators coming from two parties. Now the senate
阅读全文
摘要:In English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. For
阅读全文
摘要:Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are c
阅读全文
摘要:You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can follow an
阅读全文
摘要:Solve a given equation and return the value of x in the form of string "x=#value". The equation contains only '+', '-' operation, the variable x and i
阅读全文
摘要:The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another n
阅读全文
摘要:Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the
阅读全文
摘要:A message containing letters from A-Z is being encoded to numbers using the following mapping way: Beyond that, now the encoded string can also contai
阅读全文
摘要:In LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or mo
阅读全文
摘要:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Input: 3 / \ 9 20 / \ 15 7 Outp
阅读全文
摘要:Given the running logs of n functions that are executed in a nonpreemptive single threaded CPU, find the exclusive time of these functions. Each funct
阅读全文
摘要:You are given several logs that each log contains a unique id and timestamp. Timestamp is a string that has the following format: Year:Month:Day:Hour:
阅读全文
摘要:In combinatorial mathematics, a derangement is a permutation of the elements of a set, such that no element appears in its original position. There's
阅读全文
摘要:You have k lists of sorted integers in ascending order. Find the smallest range that includes at least one number from each of the k lists. We define
阅读全文
摘要:Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Example 2: 这道题让我们求一个数是否
阅读全文
摘要:Your task is to design the basic function of Excel and implement the function of sum formula. Specifically, you need to implement the following functi
阅读全文
摘要:Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one cha
阅读全文
摘要:Given n processes, each process has a unique PID (process id) and its PPID (parent process id). Each process only has one parent process, but may have
阅读全文
摘要:There are n different online courses numbered from 1 to n. Each course has some duration(course length) tand closed on dth day. A course should be tak
阅读全文