Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given arrays nums1 and nums2 of the same length, for every element in nums1, consider the corresponding element in nums2 (at the same index). Return
Given arrays nums1 and nums2 of the same length, for every element in nums1, consider the corresponding element in nums2 (at the same index). Return the count of the number of times that the two elements differ by 2 or less, but are not equal. matchUp([1, 2, 3], [2, 3, 10]) - 2 matchUp ([1, 2, 3], [2, 3, 5]) - 3 matchUp([1, 2, 3], [2, 3, 3]) - 2 For example: Test Result int nums1 = {2, 9, 9, 2, 7, 4, 3, 3, 2, 7}; 5 int nums2 = {4, 2, 1, 6, 3, 2, 1, 4, 3, 7}; System. out . print In(matchUp (nums1, nums2) ) ; Answer: (penalty regime: 0, 10, 20, 50, ... %) Reset answer 1 public int matchUp(int nums1, int nums2) { 2 // TODO your code goes here 3 13
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started