[Codeforces] Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2) D. BackspaceRead more
[Codeforces] Round #741 (Div. 2) C. RingsRead more
[Codeforces] Educational Round 113 (Rated for Div. 2) C. Jury MeetingRead more
[LeetCode] Count Special Integers

2376. Count Special Integers

We call a positive integer special if all of its digits are distinct.

Given a positive integer n, return the number of special integers that belong to the interval [1, n].

Read more
[LeetCode] Construct Smallest Number From DI String

2375. Construct Smallest Number From DI String

You are given a 0-indexed string pattern of length n consisting of the characters ‘I’ meaning increasing and ‘D’ meaning decreasing.

A 0-indexed string num of length n + 1 is created using the following conditions:

  • num consists of the digits ‘1’ to ‘9’, where each digit is used at most once.
  • If pattern[i] == ‘I’, then num[i] < num[i + 1].
  • If pattern[i] == ‘D’, then num[i] > num[i + 1].

Return the lexicographically smallest possible string num that meets the conditions.

Read more
[LeetCode] Node With Highest Edge Score

2374. Node With Highest Edge Score

You are given a directed graph with n nodes labeled from 0 to n - 1, where each node has exactly one outgoing edge.

The graph is represented by a given 0-indexed integer array edges of length n, where edges[i] indicates that there is a directed edge from node i to node edges[i].

The edge score of a node i is defined as the sum of the labels of all the nodes that have an edge pointing to i.

Return the node with the highest edge score. If multiple nodes have the same edge score, return the node with the smallest index.

Read more
[LeetCode] Largest Local Values in a Matrix

2373. Largest Local Values in a Matrix

You are given an n x n integer matrix grid.

Generate an integer matrix maxLocal of size (n - 2) x (n - 2) such that:

  • maxLocal[i][j] is equal to the largest value of the 3 x 3 matrix in grid centered around row i + 1 and column j + 1.

In other words, we want to find the largest value in every contiguous 3 x 3 matrix in grid.

Return the generated matrix.

Read more
[AtCoder] D - DerangementRead more
[AtCoder] C - TogetherRead more
[AtCoder] D - joisino`s travelRead more