Tap here to switch tabs
Problem
Submissions

Problem: Constructing Two Increasing Arrays

med
30 min
Try to solve the Constructing Two Increasing Arrays problem.

Statement

You are given two binary arrays nums1 and nums2.

You need to replace every element in both arrays with a positive integer such that:

  • Each element in nums1 is replaced by a positive integer xx such that x(mod2)=extoriginalvaluex \pmod 2 = ext{original value}.

  • Each element in nums2 is replaced by a positive integer yy such that y(mod2)=extoriginalvaluey \pmod 2 = ext{original value}.

  • Both nums1 and nums2 are strictly increasing.

  • All elements in both arrays are distinct.

Return the minimum possible value of the largest element among both constructed arrays.

Constraints:

  • 0≤0 \leq nums1.length ≤1000\leq 1000

  • 1≤1 \leq nums2.length ≤1000\leq 1000

  • nums1 and nums2 consist only of 00 and 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Constructing Two Increasing Arrays

med
30 min
Try to solve the Constructing Two Increasing Arrays problem.

Statement

You are given two binary arrays nums1 and nums2.

You need to replace every element in both arrays with a positive integer such that:

  • Each element in nums1 is replaced by a positive integer xx such that x(mod2)=extoriginalvaluex \pmod 2 = ext{original value}.

  • Each element in nums2 is replaced by a positive integer yy such that y(mod2)=extoriginalvaluey \pmod 2 = ext{original value}.

  • Both nums1 and nums2 are strictly increasing.

  • All elements in both arrays are distinct.

Return the minimum possible value of the largest element among both constructed arrays.

Constraints:

  • 0≤0 \leq nums1.length ≤1000\leq 1000

  • 1≤1 \leq nums2.length ≤1000\leq 1000

  • nums1 and nums2 consist only of 00 and 11.