随笔分类 - Array
发表于 2019-04-13 12:27阅读:448评论:0推荐:0
摘要:In a row of dominoes, A[i] and B[i] represent the top and bottom halves of the i-th domino. (A domino is a tile with two numbers from 1 to 6 - one on
阅读全文 »
发表于 2019-04-13 11:27阅读:288评论:0推荐:0
摘要:Given an array A of strings made only from lowercase letters, return a list of all characters that show up in all strings within the list (including d
阅读全文 »
发表于 2019-04-12 22:00阅读:441评论:0推荐:0
摘要:Given an array A of integers, return the number of (contiguous, non-empty) subarrays that have a sum divisible by K. Example 1: Note: Approach #1: Has
阅读全文 »
发表于 2019-04-11 22:33阅读:256评论:0推荐:0
摘要:Given a circular array C of integers represented by A, find the maximum possible sum of a non-empty subarray of C. Here, a circular array means the en
阅读全文 »
发表于 2019-04-11 21:29阅读:339评论: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
阅读全文 »
发表于 2019-04-11 18:11阅读:371评论:0推荐:0
摘要:Given an array of integers A, find the sum of min(B), where B ranges over every (contiguous) subarray of A. Since the answer may be large, return the
阅读全文 »
发表于 2019-04-10 22:14阅读:228评论:0推荐:0
摘要:Write an iterator that iterates through a run-length encoded sequence. The iterator is initialized by RLEIterator(int[] A), where A is a run-length en
阅读全文 »
发表于 2019-04-08 11:58阅读:251评论: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
阅读全文 »
发表于 2019-04-06 21:09阅读:283评论: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
阅读全文 »
发表于 2019-04-06 20:21阅读:917评论: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
阅读全文 »
发表于 2019-04-06 13:40阅读:224评论: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
阅读全文 »
发表于 2019-04-06 12:39阅读:247评论: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
阅读全文 »
发表于 2019-04-06 11:46阅读:238评论: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
阅读全文 »