04 2019 档案

摘要:题目如下: Given an array of integers nums, sort the array in ascending order. Example 1: Example 2: Note: 解题思路:题目没说不能用系统函数。 代码如下: 阅读全文
posted @ 2019-04-27 19:27 seyjs 阅读(318) 评论(0) 推荐(0)
摘要:题目如下: We run a preorder depth first search on the root of a binary tree. At each node in this traversal, we output D dashes (where D is the depth of t 阅读全文
posted @ 2019-04-24 23:12 seyjs 阅读(235) 评论(0) 推荐(0)
摘要:题目如下: Given an array A of integers, return the length of the longest arithmetic subsequence in A. Recall that a subsequence of A is a list A[i_1], A[i 阅读全文
posted @ 2019-04-24 23:06 seyjs 阅读(925) 评论(0) 推荐(0)
摘要:题目如下: Given the root of a binary tree, find the maximum value V for which there exists different nodes A and B where V = |A.val - B.val| and A is an a 阅读全文
posted @ 2019-04-24 23:02 seyjs 阅读(298) 评论(0) 推荐(0)
摘要:题目如下: There are 2N people a company is planning to interview. The cost of flying the i-th person to city A is costs[i][0], and the cost of flying the  阅读全文
posted @ 2019-04-24 22:56 seyjs 阅读(371) 评论(0) 推荐(0)
摘要:题目如下: We are given a matrix with R rows and C columns has cells with integer coordinates (r, c), where 0 <= r < R and 0 <= c < C. Additionally, we are 阅读全文
posted @ 2019-04-24 22:51 seyjs 阅读(446) 评论(0) 推荐(0)
摘要:题目如下: Given an array A of non-negative integers, return the maximum sum of elements in two non-overlapping (contiguous) subarrays, which have lengths  阅读全文
posted @ 2019-04-24 22:49 seyjs 阅读(269) 评论(0) 推荐(0)
摘要:题目如下: Implement the StreamChecker class as follows: StreamChecker(words): Constructor, init the data structure with the given words. query(letter): re 阅读全文
posted @ 2019-04-24 22:46 seyjs 阅读(522) 评论(0) 推荐(0)
摘要:题目如下: Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number N on the chalkboard. On each player's turn, tha 阅读全文
posted @ 2019-04-21 10:21 seyjs 阅读(1078) 评论(0) 推荐(0)
摘要:题目如下: On an infinite number line (x-axis), we drop given squares in the order they are given. The i-th square dropped (positions[i] = (left, side_leng 阅读全文
posted @ 2019-04-21 10:11 seyjs 阅读(287) 评论(0) 推荐(0)
摘要:题目如下: Create a timebased key-value store class TimeMap, that supports two operations. 1. set(string key, string value, int timestamp) Stores the key a 阅读全文
posted @ 2019-04-11 10:07 seyjs 阅读(690) 评论(0) 推荐(0)
摘要:题目如下: Given a C++ program, remove comments from it. The program source is an array where source[i] is the i-th line of the source code. This represent 阅读全文
posted @ 2019-04-11 09:53 seyjs 阅读(206) 评论(0) 推荐(0)
摘要:题目如下: You are given a series of video clips from a sporting event that lasted Tseconds. These video clips can be overlapping with each other and have 阅读全文
posted @ 2019-04-08 21:59 seyjs 阅读(696) 评论(0) 推荐(0)
摘要:题目如下: A query word matches a given pattern if we can insert lowercaseletters to the pattern word so that it equals the query. (We may insert each char 阅读全文
posted @ 2019-04-08 21:53 seyjs 阅读(300) 评论(0) 推荐(0)
摘要:题目如下: Given a binary tree, each node has value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit. For e 阅读全文
posted @ 2019-04-08 21:48 seyjs 阅读(302) 评论(0) 推荐(0)
摘要:题目如下: A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses strings, and + represents string c 阅读全文
posted @ 2019-04-08 21:47 seyjs 阅读(415) 评论(0) 推荐(0)
摘要:题目如下: Given a 2D array A, each cell is 0 (representing sea) or 1 (representing land) A move consists of walking from one land square 4-directionally t 阅读全文
posted @ 2019-04-01 15:45 seyjs 阅读(422) 评论(0) 推荐(0)
摘要:题目如下: We are given a linked list with head as the first node. Let's number the nodes in the list: node_1, node_2, node_3, ... etc. Each node may have 阅读全文
posted @ 2019-04-01 15:42 seyjs 阅读(618) 评论(0) 推荐(0)
摘要:题目如下: Given a number N, return a string consisting of "0"s and "1"s that represents its value in base -2 (negative two). The returned string must have 阅读全文
posted @ 2019-04-01 10:47 seyjs 阅读(548) 评论(0) 推荐(0)
摘要:题目如下: Given an array A of 0s and 1s, consider N_i: the i-th subarray from A[0] to A[i] interpreted as a binary number (from most-significant-bit to le 阅读全文
posted @ 2019-04-01 10:28 seyjs 阅读(460) 评论(0) 推荐(0)
摘要:题目如下: One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null 阅读全文
posted @ 2019-04-01 10:24 seyjs 阅读(109) 评论(0) 推荐(0)