AlgoUniversity
  • Go Back
Discussion
Array Matching :

Author

Akshay Sharma

Difficulty Level : Medium

Submissions : 61

Asked In : Tiktok

Marks :100

: 1 | : 0

Given two arrays A and B of the same length N. You can select a subset of A and increment them by 1. You can only do this at most once. You can also freely re-arrange elements in A.

Return True if A can be made into B, False otherwise.

Input

The first line of the test case contains an integer N ($$$1 \le n \le 1e6 $$$)the length of arrays A and B.

The next line contains n spaced integers of array A that is ($$$a_i,a_{i+1}.......a_{n-1}$$$).

The next line contains n spaced integers of array B that is ($$$b_i,b_{i+1}......b{n-1}$$$).

Output

For each test case print Yes or No if it is possible to make array A equal to array B or not.

Example

Input
5
1 2 3 4 5
5 1 1 3 4
Output
NO

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.