[LeetCode] Find Edges in Shortest Paths

3123. Find Edges in Shortest Paths

You are given an undirected weighted graph of n nodes numbered from 0 to n - 1. The graph consists of m edges represented by a 2D array edges, where edges[i] = [ai, bi, wi] indicates that there is an edge between nodes ai and bi with weight wi.

Consider all the shortest paths from node 0 to node n - 1 in the graph. You need to find a boolean array answer where answer[i] is true if the edge edges[i] is part of at least one shortest path. Otherwise, answer[i] is false.

Return the array answer.

Note that the graph may not be connected.

Read more
[LeetCode] Minimum Number of Operations to Satisfy Conditions

3122. Minimum Number of Operations to Satisfy Conditions

You are given a 2D matrix grid of size m x n. In one operation, you can change the value of any cell to any non-negative number. You need to perform some operations such that each cell grid[i][j] is:

  • Equal to the cell below it, i.e. grid[i][j] == grid[i + 1][j] (if it exists).
  • Different from the cell to its right, i.e. grid[i][j] != grid[i][j + 1] (if it exists).

Return the minimum number of operations needed.

Read more
[LeetCode] Count the Number of Special Characters II

3121. Count the Number of Special Characters II

You are given a string word. A letter c is called special if it appears both in lowercase and uppercase in word, and every lowercase occurrence of c appears before the first uppercase occurrence of c.

Return the number of special letters in word.

Read more
[LeetCode] Count the Number of Special Characters I

3120. Count the Number of Special Characters I

You are given a string word. A letter is called special if it appears both in lowercase and uppercase in word.

Return the number of special letters in word.

Read more
[Codeforces] Round 914 (Div. 2) D2. Set To Max (Hard Version)Read more
[Codeforces] Round 914 (Div. 2) D1. Set To Max (Easy Version)Read more
[Codeforces] Round 912 (Div. 2) D1. Maximum And Queries (easy version)Read more
[Codeforces] Educational Round 158 (Rated for Div. 2) D. Yet Another Monster FightRead more
[Codeforces] Round 909 (Div. 3) F. Alex`s whimsRead more
[Codeforces] Round 910 (Div. 2) C. Colorful GridRead more