Tap here to switch tabs
Problem
Submissions

Problem: Maximum Number of Matching Indices After Right Shifts

Maximum Number of Matching Indices After Right Shifts asks for the most positions matching between two equal-length arrays after repeatedly moving the first array’s last value to the front.

Statement

You are given two integer arrays nums1 and nums2 of equal length.

In a single right shift operation, the last element of nums1 moves to index 00, and every other element moves 11 position to the right.

Return the maximum number of indices i such that nums1[i] == nums2[i] after performing any number of right shifts on nums1.

Constraints:

  • nums1.length ==== nums2.length

  • 1≤1 \leq nums1.length, nums2.length ≤3000\leq 3000

  • 1≤1 \leq nums1[i], nums2[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Number of Matching Indices After Right Shifts

Maximum Number of Matching Indices After Right Shifts asks for the most positions matching between two equal-length arrays after repeatedly moving the first array’s last value to the front.

Statement

You are given two integer arrays nums1 and nums2 of equal length.

In a single right shift operation, the last element of nums1 moves to index 00, and every other element moves 11 position to the right.

Return the maximum number of indices i such that nums1[i] == nums2[i] after performing any number of right shifts on nums1.

Constraints:

  • nums1.length ==== nums2.length

  • 1≤1 \leq nums1.length, nums2.length ≤3000\leq 3000

  • 1≤1 \leq nums1[i], nums2[i] ≤109\leq 10^9