[AtCoder] A - Many FormulaeRead more
[AtCoder] D - Kth ExcludedRead more
[AtCoder] D - CollisionRead more
[Codeforces] Round #535 (Div. 3) D. Diverse GarlandRead more
[Codeforces] Global Round 1 B. TapeRead more
[Codeforces] Round #542 [Alex Lopashev Thanks-Round] (Div. 2) C. ConnectRead more
[Codeforces] Round #541 (Div. 2) B. Draw!Read more
[Codeforces] Round #549 (Div. 2) C. QueenRead more
[LeetCode] Minimize Rounding Error to Meet Target

1058. Minimize Rounding Error to Meet Target

Given an array of prices [p1,p2…,pn] and a target, round each price pi to Roundi(pi) so that the rounded array [Round1(p1),Round2(p2)…,Roundn(pn)] sums to the given target. Each operation Roundi(pi) could be either Floor(pi) or Ceil(pi).

Return the string “-1” if the rounded array is impossible to sum to target. Otherwise, return the smallest rounding error, which is defined as Σ |Roundi(pi) - (pi)| for i from 1 to n, as a string with three places after the decimal.

Read more
[LeetCode] Matchsticks to Square

473. Matchsticks to Square

You are given an integer array matchsticks where matchsticks[i] is the length of the ith matchstick. You want to use all the matchsticks to make one square. You should not break any stick, but you can link them up, and each matchstick must be used exactly one time.

Return true if you can make this square and false otherwise.

Read more