02 2021 档案

摘要:Given two sequences pushed and popped with distinct values, return true if and only if this could have been the result of a sequence of push and pop o 阅读全文
posted @ 2021-02-28 08:28 CNoodle 阅读(144) 评论(0) 推荐(0)
摘要:An array is monotonic if it is either monotone increasing or monotone decreasing. An array A is monotone increasing if for all i <= j, A[i] <= A[j]. A 阅读全文
posted @ 2021-02-28 07:29 CNoodle 阅读(121) 评论(0) 推荐(0)
摘要:There are n buildings in a line. You are given an integer array heights of size n that represents the heights of the buildings in the line. The ocean 阅读全文
posted @ 2021-02-27 00:53 CNoodle 阅读(2190) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2021-02-26 06:01 CNoodle 阅读(131) 评论(0) 推荐(0)
摘要:Given a balanced parentheses string S, compute the score of the string based on the following rule: () has score 1 AB has score A + B, where A and B a 阅读全文
posted @ 2021-02-25 04:22 CNoodle 阅读(133) 评论(0) 推荐(0)
摘要:Consider a directed graph, with nodes labelled 0, 1, ..., n-1. In this graph, each edge is either red or blue, and there could be self-edges or parall 阅读全文
posted @ 2021-02-25 03:18 CNoodle 阅读(131) 评论(0) 推荐(0)
摘要:There are 3n piles of coins of varying size, you and your friends will take piles of coins as follows: In each step, you will choose any 3 piles of co 阅读全文
posted @ 2021-02-25 01:05 CNoodle 阅读(232) 评论(0) 推荐(0)
摘要:Today, the bookstore owner has a store open for customers.length minutes. Every minute, some number of customers (customers[i]) enter the store, and a 阅读全文
posted @ 2021-02-24 01:13 CNoodle 阅读(111) 评论(0) 推荐(0)
摘要:On a broken calculator that has a number showing on its display, we can perform two operations: Double: Multiply the number on the display by 2, or; D 阅读全文
posted @ 2021-02-23 11:14 CNoodle 阅读(110) 评论(0) 推荐(0)
摘要:In a warehouse, there is a row of barcodes, where the ith barcode is barcodes[i]. Rearrange the barcodes so that no two adjacent barcodes are equal. Y 阅读全文
posted @ 2021-02-23 01:27 CNoodle 阅读(81) 评论(0) 推荐(0)
摘要:The diameter of a tree is the number of edges in the longest path in that tree. There is an undirected tree of n nodes labeled from 0 to n - 1. You ar 阅读全文
posted @ 2021-02-20 01:41 CNoodle 阅读(573) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, find the maximum average value of any subtree of that tree. (A subtree of a tree is any node of that tree plus all it 阅读全文
posted @ 2021-02-19 04:15 CNoodle 阅读(836) 评论(0) 推荐(0)
摘要:An integer array is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same 阅读全文
posted @ 2021-02-19 02:09 CNoodle 阅读(293) 评论(1) 推荐(0)
摘要:Given a rectangular cake with height h and width w, and two arrays of integers horizontalCuts and verticalCuts where horizontalCuts[i] is the distance 阅读全文
posted @ 2021-02-17 15:47 CNoodle 阅读(353) 评论(0) 推荐(0)
摘要:Given a m * n matrix mat of ones (representing soldiers) and zeros (representing civilians), return the indexes of the k weakest rows in the matrix or 阅读全文
posted @ 2021-02-17 13:25 CNoodle 阅读(265) 评论(0) 推荐(0)
摘要:In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. 阅读全文
posted @ 2021-02-17 05:40 CNoodle 阅读(201) 评论(0) 推荐(0)
摘要:Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, 阅读全文
posted @ 2021-02-15 06:09 CNoodle 阅读(326) 评论(0) 推荐(0)
摘要:N couples sit in 2N seats arranged in a row and want to hold hands. We want to know the minimum number of swaps so that every couple is sitting side b 阅读全文
posted @ 2021-02-14 13:58 CNoodle 阅读(350) 评论(0) 推荐(0)
摘要:Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1. A clear path in a 阅读全文
posted @ 2021-02-14 08:24 CNoodle 阅读(234) 评论(0) 推荐(0)
摘要:Given an integer array arr, return the length of a maximum size turbulent subarray of arr. A subarray is turbulent if the comparison sign flips betwee 阅读全文
posted @ 2021-02-14 03:46 CNoodle 阅读(111) 评论(0) 推荐(0)
摘要:The distance of a pair of integers a and b is defined as the absolute difference between a and b. Given an integer array nums and an integer k, return 阅读全文
posted @ 2021-02-13 07:39 CNoodle 阅读(157) 评论(0) 推荐(0)
摘要:Given 3 positives numbers a, b and c. Return the minimum flips required in some bits of a and b to make ( a OR b == c ). (bitwise OR operation).Flip o 阅读全文
posted @ 2021-02-10 16:16 CNoodle 阅读(244) 评论(0) 推荐(0)
摘要:You are given two strings s and t of the same length and an integer maxCost. You want to change s to t. Changing the ith character of s to ith charact 阅读全文
posted @ 2021-02-10 07:11 CNoodle 阅读(130) 评论(0) 推荐(0)
摘要:Given an integer k, return the minimum number of Fibonacci numbers whose sum is equal to k. The same Fibonacci number can be used multiple times. The 阅读全文
posted @ 2021-02-08 16:08 CNoodle 阅读(226) 评论(0) 推荐(0)
摘要:Given a string s and a character c that occurs in s, return an array of integers answer where answer.length == s.length and answer[i] is the shortest 阅读全文
posted @ 2021-02-08 03:23 CNoodle 阅读(129) 评论(0) 推荐(0)
摘要:Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most one element. We define an array is n 阅读全文
posted @ 2021-02-07 04:16 CNoodle 阅读(149) 评论(0) 推荐(0)
摘要:There are several cards arranged in a row, and each card has an associated number of points. The points are given in the integer array cardPoints. In 阅读全文
posted @ 2021-02-06 16:15 CNoodle 阅读(454) 评论(0) 推荐(0)
摘要:We define a harmonious array as an array where the difference between its maximum value and its minimum value is exactly 1. Given an integer array num 阅读全文
posted @ 2021-02-06 13:20 CNoodle 阅读(137) 评论(0) 推荐(0)
摘要:You are given a string s that consists of lower case English letters and brackets. Reverse the strings in each pair of matching parentheses, starting  阅读全文
posted @ 2021-02-05 16:53 CNoodle 阅读(175) 评论(0) 推荐(0)
摘要:Given an integer array arr, and an integer target, return the number of tuples i, j, k such that i < j < k and arr[i] + arr[j] + arr[k] == target. As 阅读全文
posted @ 2021-02-05 03:12 CNoodle 阅读(191) 评论(0) 推荐(0)
摘要:You are given an integer array nums consisting of n elements, and an integer k. Find a contiguous subarray whose length is equal to k that has the max 阅读全文
posted @ 2021-02-05 01:18 CNoodle 阅读(320) 评论(0) 推荐(0)
摘要:Given the root of a binary search tree and the lowest and highest boundaries as low and high, trim the tree so that all its elements lies in [low, hig 阅读全文
posted @ 2021-02-03 16:14 CNoodle 阅读(207) 评论(0) 推荐(0)
摘要:There is an integer array nums that consists of n unique elements, but you have forgotten it. However, you do remember every pair of adjacent elements 阅读全文
posted @ 2021-02-02 02:01 CNoodle 阅读(302) 评论(0) 推荐(0)
摘要:Alice and Bob have candy bars of different sizes: A[i] is the size of the i-th bar of candy that Alice has, and B[j] is the size of the j-th bar of ca 阅读全文
posted @ 2021-02-01 06:29 CNoodle 阅读(92) 评论(0) 推荐(0)