1464. Maximum Product of Two Elements in an Array
Given the array of integers
nums, you will choose two different indicesiandjof that array. Return the maximum value of(nums[i]-1)*(nums[j]-1).
2912. Number of Ways to Reach Destination in the Grid
You are given two integers
nandmwhich represent the size of a 1-indexed grid. You are also given an integerk, a 1-indexed integer arraysourceand a 1-indexed integer arraydest, wheresourceanddestare 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 eitherx1 == x2ory1 == y2.- Note that you can’t move to the cell you are already in e.g.
x1 == x2andy1 == y2.Return the number of ways you can reach
destfromsourceby moving through the grid exactlyktimes.Since the answer may be very large, return it modulo
109 + 7.