[Hacker Earth] Edge Strength (Lowe)Read more
[Hacker Earth] The MarketRead more
[Hacker Earth] Killjee and base XRead more
[Codeforces] Round 150 (Div. 1) B. HydraRead more
[Codeforces] CROC-MBTU 2012, Elimination Round (ACM-ICPC) F. Log Stream AnalysisRead more
[Codeforces] Round 152 (Div. 2) C. Robo-FootballerRead more
[Codeforces] CROC-MBTU 2012, Final Round (Online version, Div. 2) E. Mad JoeRead more
[Codeforces] Round 153 (Div. 1) C. Number TransformationRead more
[LeetCode] Maximum Product of Two Elements in an Array

1464. Maximum Product of Two Elements in an Array

Given the array of integers nums, you will choose two different indices i and j of that array. Return the maximum value of (nums[i]-1)*(nums[j]-1).

Read more
[LeetCode] Number of Ways to Reach Destination in the Grid

2912. Number of Ways to Reach Destination in the Grid

You are given two integers n and m which represent the size of a 1-indexed grid. You are also given an integer k, a 1-indexed integer array source and a 1-indexed integer array dest, where source and dest are in the form [x, y] representing a cell on the given grid.

You can move through the grid in the following way:

  • You can go from cell [x1, y1] to cell [x2, y2] if either x1 == x2 or y1 == y2.
  • Note that you can’t move to the cell you are already in e.g. x1 == x2 and y1 == y2.

Return the number of ways you can reach dest from source by moving through the grid exactly k times.

Since the answer may be very large, return it modulo 109 + 7.

Read more