[Codeforces] Educational Round 40 (Rated for Div. 2) B. String TypingRead more
[Codeforces] Helvetic Coding Contest 2018 online mirror (teams allowed, unrated) A1. Death Stars (easy)Read more
[LeetCode] Number of Pairs of Strings With Concatenation Equal to Target

2023. Number of Pairs of Strings With Concatenation Equal to Target

Given an array of digit strings nums and a digit string target, return the number of pairs of indices (i, j) (where i != j) such that the concatenation of nums[i] + nums[j] equals target.

Read more
[LeetCode] Beautiful Array

932. Beautiful Array

An array nums of length n is beautiful if:

  • nums is a permutation of the integers in the range [1, n].
  • For every 0 <= i < j < n, there is no index k with i < k < j where 2 * nums[k] == nums[i] + nums[j].

Given the integer n, return any beautiful array nums of length n. There will be at least one valid answer for the given n.

Read more
[LeetCode] Minimum Operations to Make a Uni-Value Grid

2033. Minimum Operations to Make a Uni-Value Grid

You are given a 2D integer grid of size m x n and an integer x. In one operation, you can add x to or subtract x from any element in the grid.

A uni-value grid is a grid where all the elements of it are equal.

Return the minimum number of operations to make the grid uni-value. If it is not possible, return -1.

Read more
[LeetCode] Diagonal Traverse II

1424. Diagonal Traverse II

Given a 2D integer array nums, return all elements of nums in diagonal order as shown in the below images.

Read more
[LeetCode] Friends Of Appropriate Ages

825. Friends Of Appropriate Ages

There are n persons on a social media website. You are given an integer array ages where ages[i] is the age of the ith person.

A Person x will not send a friend request to a person y (x != y) if any of the following conditions is true:

  • age[y] <= 0.5 * age[x] + 7
  • age[y] > age[x]
  • age[y] > 100 && age[x] < 100

Otherwise, x will send a friend request to y.

Note that if x sends a request to y, y will not necessarily send a request to x. Also, a person will not send a friend request to themself.

Return the total number of friend requests made.

Read more
[AtCoder] D - Sky ReflectorRead more
[AtCoder] C - String InvasionRead more
[AtCoder] B - A^B^CRead more