随笔分类 -  Leetcode

上一页 1 2 3 4 5 6 7 8 9 ··· 23 下一页
摘要:Given an array of integers A, consider all non-empty subsequences of A. For any sequence S, let the width of S be the difference between the maximum a 阅读全文
posted @ 2019-04-09 21:41 Veritas_des_Liberty 阅读(297) 评论(0) 推荐(0) 编辑
摘要:Two images A and B are given, represented as binary, square matrices of the same size. (A binary matrix has only 0s and 1s as values.) We translate on 阅读全文
posted @ 2019-04-08 11:58 Veritas_des_Liberty 阅读(246) 评论(0) 推荐(0) 编辑
摘要:1021. Remove Outermost Parentheses A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses strin 阅读全文
posted @ 2019-04-07 20:39 Veritas_des_Liberty 阅读(228) 评论(0) 推荐(0) 编辑
摘要:Given string S and a dictionary of words words, find the number of words[i] that is a subsequence of S. Note: All words in words and S will only consi 阅读全文
posted @ 2019-04-06 21:09 Veritas_des_Liberty 阅读(282) 评论(0) 推荐(0) 编辑
摘要:An N x N board contains only 0s and 1s. In each move, you can swap any 2 rows with each other, or any 2 columns with each other. What is the minimum n 阅读全文
posted @ 2019-04-06 20:21 Veritas_des_Liberty 阅读(910) 评论(0) 推荐(0) 编辑
摘要:We have some permutation A of [0, 1, ..., N - 1], where N is the length of A. The number of (global) inversions is the number of i < j with 0 <= i < j 阅读全文
posted @ 2019-04-06 13:40 Veritas_des_Liberty 阅读(218) 评论(0) 推荐(0) 编辑
摘要:This question is the same as "Max Chunks to Make Sorted" except the integers of the given array are not necessarily distinct, the input array could be 阅读全文
posted @ 2019-04-06 12:39 Veritas_des_Liberty 阅读(246) 评论(0) 推荐(0) 编辑
摘要:Given an array arr that is a permutation of [0, 1, ..., arr.length - 1], we split the array into some number of "chunks" (partitions), and individuall 阅读全文
posted @ 2019-04-06 11:46 Veritas_des_Liberty 阅读(238) 评论(0) 推荐(0) 编辑
摘要:Your are given an array of positive integers nums. Count and print the number of (contiguous) subarrays where the product of all the elements in the s 阅读全文
posted @ 2019-04-05 15:10 Veritas_des_Liberty 阅读(319) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t 阅读全文
posted @ 2019-04-05 14:38 Veritas_des_Liberty 阅读(208) 评论(0) 推荐(0) 编辑
摘要:Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get. 阅读全文
posted @ 2019-04-04 15:54 Veritas_des_Liberty 阅读(195) 评论(0) 推荐(0) 编辑
摘要:Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requ 阅读全文
posted @ 2019-04-04 14:05 Veritas_des_Liberty 阅读(184) 评论(0) 推荐(0) 编辑
摘要:Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the ave 阅读全文
posted @ 2019-04-04 11:39 Veritas_des_Liberty 阅读(232) 评论(0) 推荐(0) 编辑
摘要:Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be 阅读全文
posted @ 2019-04-02 22:33 Veritas_des_Liberty 阅读(201) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Note: The len 阅读全文
posted @ 2019-04-02 10:27 Veritas_des_Liberty 阅读(165) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twi 阅读全文
posted @ 2019-04-01 12:03 Veritas_des_Liberty 阅读(210) 评论(0) 推荐(0) 编辑
摘要:Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Example 2: Note: Try to come up as many solutions as you 阅读全文
posted @ 2019-03-30 11:29 Veritas_des_Liberty 阅读(158) 评论(0) 推荐(0) 编辑
摘要:There are N piles of stones arranged in a row. The i-th pile has stones[i] stones. A move consists of merging exactly K consecutive piles into one pil 阅读全文
posted @ 2019-03-28 19:43 Veritas_des_Liberty 阅读(259) 评论(0) 推荐(0) 编辑
摘要:A subarray A[i], A[i+1], ..., A[j] of A is said to be turbulent if and only if: For i <= k < j, A[k] > A[k+1] when k is odd, and A[k] < A[k+1] when k  阅读全文
posted @ 2019-03-28 17:23 Veritas_des_Liberty 阅读(356) 评论(0) 推荐(0) 编辑
摘要:You are given an integer array A. From some starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...) jumps in the series are called od 阅读全文
posted @ 2019-03-28 17:04 Veritas_des_Liberty 阅读(280) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 ··· 23 下一页