09 2020 档案

摘要:Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains less than 2 el 阅读全文
posted @ 2020-09-30 07:53 CNoodle 阅读(251) 评论(0) 推荐(0)
摘要:In a deck of cards, each card has an integer written on it. Return true if and only if you can choose X >= 2 such that it is possible to split the ent 阅读全文
posted @ 2020-09-29 14:27 CNoodle 阅读(156) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed). Example 1: Input: root = [1,3,2,5,3,null,9] 阅读全文
posted @ 2020-09-29 08:56 CNoodle 阅读(233) 评论(0) 推荐(0)
摘要:Given an array of events where events[i] = [startDayi, endDayi]. Every event i starts at startDayi and ends at endDayi. You can attend an event i at a 阅读全文
posted @ 2020-09-28 12:40 CNoodle 阅读(887) 评论(0) 推荐(0)
摘要:We have n buildings numbered from 0 to n - 1. Each building has a number of employees. It's transfer season, and some employees want to change the bui 阅读全文
posted @ 2020-09-28 10:02 CNoodle 阅读(477) 评论(0) 推荐(0)
摘要:A kingdom consists of a king, his children, his grandchildren, and so on. Every once in a while, someone in the family dies or a child is born. The ki 阅读全文
posted @ 2020-09-28 08:36 CNoodle 阅读(396) 评论(0) 推荐(0)
摘要:You are the operator of a Centennial Wheel that has four gondolas, and each gondola has room for up to four people. You have the ability to rotate the 阅读全文
posted @ 2020-09-27 13:08 CNoodle 阅读(308) 评论(0) 推荐(0)
摘要:The Leetcode file system keeps a log each time some user performs a change folder operation. The operations are described below: "../" : Move to the p 阅读全文
posted @ 2020-09-27 12:17 CNoodle 阅读(427) 评论(0) 推荐(0)
摘要:There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i 阅读全文
posted @ 2020-09-27 09:41 CNoodle 阅读(334) 评论(0) 推荐(0)
摘要:You are given an array of n pairs pairs where pairs[i] = [lefti, righti] and lefti < righti. A pair p2 = [c, d] follows a pair p1 = [a, b] if b < c. A 阅读全文
posted @ 2020-09-27 08:10 CNoodle 阅读(300) 评论(0) 推荐(0)
摘要:Given an integer array nums, return all the different possible non-decreasing subsequences of the given array with at least two elements. You may retu 阅读全文
posted @ 2020-09-27 04:04 CNoodle 阅读(157) 评论(0) 推荐(0)
摘要:Given the head of a singly linked list, sort the list using insertion sort, and return the sorted list's head. The steps of the insertion sort algorit 阅读全文
posted @ 2020-09-27 03:14 CNoodle 阅读(529) 评论(0) 推荐(0)
摘要:Given a node from a Circular Linked List which is sorted in ascending order, write a function to insert a value insertVal into the list such that it r 阅读全文
posted @ 2020-09-24 13:51 CNoodle 阅读(241) 评论(0) 推荐(0)
摘要:Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is define 阅读全文
posted @ 2020-09-24 11:39 CNoodle 阅读(203) 评论(0) 推荐(0)
摘要:Given a list of the scores of different students, items, where items[i] = [IDi, scorei] represents one score from a student with IDi, calculate each s 阅读全文
posted @ 2020-09-24 08:31 CNoodle 阅读(855) 评论(0) 推荐(0)
摘要:Given an array nums sorted in non-decreasing order, and a number target, return True if and only if target is a majority element. A majority element i 阅读全文
posted @ 2020-09-24 07:49 CNoodle 阅读(238) 评论(0) 推荐(0)
摘要:Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. Example 1: Input: nums = [3,2,3] Output: [3] Example 2: Input 阅读全文
posted @ 2020-09-23 15:07 CNoodle 阅读(188) 评论(0) 推荐(0)
摘要:You are given the root of a binary tree with n nodes where each node in the tree has node.val coins. There are n coins in total throughout the whole t 阅读全文
posted @ 2020-09-22 14:59 CNoodle 阅读(208) 评论(0) 推荐(0)
摘要:Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus 阅读全文
posted @ 2020-09-21 13:23 CNoodle 阅读(243) 评论(0) 推荐(0)
摘要:You are given an array prices where prices[i] is the price of a given stock on the ith day, and an integer fee representing a transaction fee. Find th 阅读全文
posted @ 2020-09-21 11:39 CNoodle 阅读(185) 评论(0) 推荐(0)
摘要:You are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete 阅读全文
posted @ 2020-09-21 05:48 CNoodle 阅读(395) 评论(0) 推荐(0)
摘要:An integer has sequential digits if and only if each digit in the number is one more than the previous digit. Return a sorted list of all the integers 阅读全文
posted @ 2020-09-20 10:43 CNoodle 阅读(488) 评论(0) 推荐(0)
摘要:You are given an integer array prices where prices[i] is the price of a given stock on the ith day, and an integer k. Find the maximum profit you can 阅读全文
posted @ 2020-09-20 06:41 CNoodle 阅读(375) 评论(0) 推荐(0)
摘要:You are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete  阅读全文
posted @ 2020-09-20 03:48 CNoodle 阅读(527) 评论(0) 推荐(0)
摘要:Given an integer array nums, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array wil 阅读全文
posted @ 2020-09-19 07:40 CNoodle 阅读(235) 评论(0) 推荐(0)
摘要:On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions: "G": go straight 1 unit; "L 阅读全文
posted @ 2020-09-18 07:29 CNoodle 阅读(285) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, each node in the tree has a distinct value. After deleting all nodes with a value in to_delete, we are left with a fo 阅读全文
posted @ 2020-09-17 15:02 CNoodle 阅读(212) 评论(0) 推荐(0)
摘要:Given an integer array nums, return the maximum result of nums[i] XOR nums[j], where 0 <= i <= j < n. Example 1: Input: nums = [3,10,5,25,2,8] Output: 阅读全文
posted @ 2020-09-17 13:12 CNoodle 阅读(269) 评论(0) 推荐(0)
摘要:There are n flights that are labeled from 1 to n. You are given an array of flight bookings bookings, where bookings[i] = [firsti, lasti, seatsi] repr 阅读全文
posted @ 2020-09-17 08:08 CNoodle 阅读(379) 评论(0) 推荐(0)
摘要:Given a positive integer N, how many ways can we write it as a sum of consecutive positive integers? Example 1: Input: 5 Output: 2 Explanation: 5 = 5 阅读全文
posted @ 2020-09-13 10:39 CNoodle 阅读(225) 评论(0) 推荐(0)
摘要:Given a node in a binary search tree, find the in-order successor of that node in the BST. If that node has no in-order successor, return null. The su 阅读全文
posted @ 2020-09-12 15:45 CNoodle 阅读(252) 评论(0) 推荐(0)
摘要:Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2: Inp 阅读全文
posted @ 2020-09-12 06:40 CNoodle 阅读(217) 评论(0) 推荐(0)
摘要:You are playing the Bulls and Cows game with your friend. You write down a secret number and ask your friend to guess what the number is. When your fr 阅读全文
posted @ 2020-09-11 02:10 CNoodle 阅读(340) 评论(0) 推荐(0)
摘要:Given a root of an N-ary tree, return a deep copy (clone) of the tree. Each node in the n-ary tree contains a val (int) and a list (List[Node]) of its 阅读全文
posted @ 2020-09-10 05:47 CNoodle 阅读(563) 评论(0) 推荐(0)
摘要:Given an array of distinct integers nums and a target integer target, return the number of possible combinations that add up to target. The answer is  阅读全文
posted @ 2020-09-10 04:17 CNoodle 阅读(244) 评论(0) 推荐(0)
摘要:A conveyor belt has packages that must be shipped from one port to another within days days. The ith package on the conveyor belt has a weight of weig 阅读全文
posted @ 2020-09-09 14:27 CNoodle 阅读(280) 评论(0) 推荐(0)
摘要:Koko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. The guards have gone and will come back in H hours. Koko 阅读全文
posted @ 2020-09-09 10:38 CNoodle 阅读(372) 评论(0) 推荐(0)
摘要:You are given the root of a binary tree where each node has a value 0 or 1. Each root-to-leaf path represents a binary number starting with the most s 阅读全文
posted @ 2020-09-09 05:58 CNoodle 阅读(274) 评论(0) 推荐(0)
摘要:Given an array arr of positive integers sorted in a strictly increasing order, and an integer k. Find the kth positive integer that is missing from th 阅读全文
posted @ 2020-09-08 15:30 CNoodle 阅读(1624) 评论(0) 推荐(0)
摘要:On a campus represented as a 2D grid, there are N workers and M bikes, with N <= M. Each worker and bike is a 2D coordinate on this grid. Our goal is 阅读全文
posted @ 2020-09-08 11:58 CNoodle 阅读(247) 评论(0) 推荐(0)
摘要:Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in 阅读全文
posted @ 2020-09-08 00:53 CNoodle 阅读(212) 评论(0) 推荐(0)
摘要:There is a car with capacity empty seats. The vehicle only drives east (i.e., it cannot turn around and drive west). You are given the integer capacit 阅读全文
posted @ 2020-09-08 00:10 CNoodle 阅读(587) 评论(0) 推荐(0)
摘要:Given the coordinates of two rectilinear rectangles in a 2D plane, return the total area covered by the two rectangles. The first rectangle is defined 阅读全文
posted @ 2020-09-07 06:24 CNoodle 阅读(242) 评论(0) 推荐(0)
摘要:You are given two images, img1 and img2, represented as binary, square matrices of size n x n. A binary matrix has only 0s and 1s as values. We transl 阅读全文
posted @ 2020-09-07 05:05 CNoodle 阅读(240) 评论(0) 推荐(0)
摘要:An axis-aligned rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) is the coordinate of its bottom-left corner, and (x2, y2) is the c 阅读全文
posted @ 2020-09-07 03:19 CNoodle 阅读(248) 评论(0) 推荐(0)
摘要:Given an n-ary tree, return the level order traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversa 阅读全文
posted @ 2020-09-07 02:05 CNoodle 阅读(164) 评论(0) 推荐(0)
摘要:Given two binary search trees root1 and root2. Return a list containing all the integers from both trees sorted in ascending order. Example 1: Input: 阅读全文
posted @ 2020-09-06 14:04 CNoodle 阅读(294) 评论(0) 推荐(0)
摘要:Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal. In one move, you can increment or 阅读全文
posted @ 2020-09-04 05:38 CNoodle 阅读(348) 评论(0) 推荐(0)
摘要:Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal. In one move, you can increment n 阅读全文
posted @ 2020-09-04 04:36 CNoodle 阅读(270) 评论(0) 推荐(0)
摘要:Given a file and assume that you can only read the file using a given method read4, implement a method read to read n characters. Your method read may 阅读全文
posted @ 2020-09-02 07:59 CNoodle 阅读(471) 评论(0) 推荐(0)
摘要:Given a file and assume that you can only read the file using a given method read4, implement a method to read n characters. Method read4: The API rea 阅读全文
posted @ 2020-09-02 02:47 CNoodle 阅读(428) 评论(0) 推荐(0)
摘要:Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into sets of k consecutive numbersReturn Tru 阅读全文
posted @ 2020-09-01 05:13 CNoodle 阅读(366) 评论(0) 推荐(0)
摘要:You are given the root of a binary search tree (BST), where exactly two nodes of the tree were swapped by mistake. Recover the tree without changing i 阅读全文
posted @ 2020-09-01 04:38 CNoodle 阅读(461) 评论(0) 推荐(0)