Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed
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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions