[Hacker Earth] Let`s swapRead more
[Hacker Earth] Array modificationRead more
[Hacker Earth] The family tree of BobRead more
[Codeforces] Round 781 (Div. 2) D. GCD GuessRead more
[Codeforces] Global Round 20 F1. Array ShufflingRead more
[Codeforces] Round 786 (Div. 3) E. Breaking the WallRead more
[Codeforces] Round 786 (Div. 3) G. Remove Directed EdgesRead more
[Codeforces] Educational Round 128 (Rated for Div. 2) E. Moving ChipsRead more
[LeetCode] Count Visited Nodes in a Directed Graph

2876. Count Visited Nodes in a Directed Graph

There is a directed graph consisting of n nodes numbered from 0 to n - 1 and n directed edges.

You are given a 0-indexed array edges where edges[i] indicates that there is an edge from node i to node edges[i].

Consider the following process on the graph:

  • You start from a node x and keep visiting other nodes through edges until you reach a node that you have already visited before on this same process.

Return an array answer where answer[i] is the number of different nodes that you will visit if you perform the process starting from node i.

Read more
[LeetCode] Minimum Size Subarray in Infinite Array

2875. Minimum Size Subarray in Infinite Array

You are given a 0-indexed array nums and an integer target.

A 0-indexed array infinite_nums is generated by infinitely appending the elements of nums to itself.

Return the length of the shortest subarray of the array infinite_nums with a sum equal to target. If there is no such subarray return -1.

Read more