随笔分类 -  Algorithm

上一页 1 ··· 3 4 5 6 7 8 9 10 下一页
摘要:Given an array that has n integers, count the number of ways to split all elements of this array into 3 contiguous parts so that the sum of each part 阅读全文
posted @ 2019-10-29 02:10 Review->Improve 阅读(503) 评论(0) 推荐(0)
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2019-10-28 10:23 Review->Improve 阅读(190) 评论(0) 推荐(0)
摘要:Consider a multiset of integers S, the union of n closed intervals of positive integers: S = [l1..r1] ∪ [l2..r2] ∪ · · · ∪ [ln..rn](recall that a clos 阅读全文
posted @ 2019-10-25 05:55 Review->Improve 阅读(247) 评论(0) 推荐(0)
摘要:Smaller input size: https://codeforces.com/contest/1249/problem/D1 Big input size: https://codeforces.com/contest/1249/problem/D2 Given n segments on 阅读全文
posted @ 2019-10-25 04:56 Review->Improve 阅读(587) 评论(0) 推荐(0)
摘要:You are given a string consisting of the letters x and y, such as xyxxxyxyy. In addition, you have an operation called flip, which changes a single x  阅读全文
posted @ 2019-10-25 00:48 Review->Improve 阅读(1298) 评论(0) 推荐(0)
摘要:You are given a string containing only 4 kinds of characters 'Q', 'W', 'E' and 'R'. A string is said to be balanced if each of its characters appears  阅读全文
posted @ 2019-10-21 22:30 Review->Improve 阅读(1256) 评论(0) 推荐(0)
摘要:Given n kinds of present and m boxes. Find out the different ways to pack all boxes with presents, using the following rules. 1. Each box can not have 阅读全文
posted @ 2019-10-18 11:25 Review->Improve 阅读(154) 评论(0) 推荐(0)
摘要:Given an array nums of positive integers, return the longest possible length of an array prefix of nums, such that it is possible to remove exactly on 阅读全文
posted @ 2019-10-14 03:10 Review->Improve 阅读(758) 评论(0) 推荐(0)
摘要:A die simulator generates a random number from 1 to 6 for each roll. You introduced a constraint to the generator such that it cannot roll the number  阅读全文
posted @ 2019-10-14 01:42 Review->Improve 阅读(1459) 评论(0) 推荐(0)
摘要:Your music player contains N different songs and she wants to listen to L (not necessarily different) songs during your trip. You create a playlist so 阅读全文
posted @ 2019-10-11 11:09 Review->Improve 阅读(336) 评论(0) 推荐(0)
摘要:Given the head of a linked list, we repeatedly delete consecutive sequences of nodes that sum to 0 until there are no such sequences. After doing so, 阅读全文
posted @ 2019-09-29 07:04 Review->Improve 阅读(889) 评论(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: Input:nums = 阅读全文
posted @ 2019-09-29 06:26 Review->Improve 阅读(439) 评论(0) 推荐(0)
摘要:There are N wines in a row. Each year you sell either the leftmost or the rightmost wine. The i-th wine has initial price p[i] and price k * p[i] in t 阅读全文
posted @ 2019-09-27 00:23 Review->Improve 阅读(401) 评论(0) 推荐(0)
摘要:In an infinite chess board with coordinates from -infinity to +infinity, you have a knight at square [0, 0]. A knight has 8 possible moves it can make 阅读全文
posted @ 2019-09-22 01:23 Review->Improve 阅读(5799) 评论(0) 推荐(0)
摘要:You have N stones in a row, and would like to create from them a pyramid. This pyramid should be constructed such that the height of each stone increa 阅读全文
posted @ 2019-09-20 05:46 Review->Improve 阅读(449) 评论(0) 推荐(0)
摘要:A competitive runner would like to create a route that starts and ends at his house, with the condition that the route goes entirely uphill at first, 阅读全文
posted @ 2019-09-19 11:38 Review->Improve 阅读(1204) 评论(0) 推荐(1)
摘要:Given an array of integers, return the maximum sum for a non-empty subarray (contiguous elements) with at most one element deletion. In other words, y 阅读全文
posted @ 2019-09-16 23:31 Review->Improve 阅读(1104) 评论(0) 推荐(0)
摘要:On a mysterious island there are creatures known as Quxes which come in three colors: red, green, and blue. One power of the Qux is that if two of the 阅读全文
posted @ 2019-09-14 03:21 Review->Improve 阅读(1928) 评论(0) 推荐(0)
摘要:Given a string s, we make queries on substrings of s. For each query queries[i] = [left, right, k], we may rearrange the substring s[left], ..., s[rig 阅读全文
posted @ 2019-09-04 23:28 Review->Improve 阅读(881) 评论(0) 推荐(0)
摘要:You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you nee 阅读全文
posted @ 2019-08-30 06:46 Review->Improve 阅读(179) 评论(0) 推荐(0)

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