⌘K
Flycodx

Check Two Arrays Have Same Elements

Check Two Arrays Have Same Elements

EasyHash Maps42% accepted

Given two arrays of the same size N, check if they contain exactly the same set of elements (with the same frequencies). Order does not matter. For example, [1,2,3] and [3,1,2] are the same; [1,2,2] and [1,1,2] are not. Print 'Yes' or 'No'.

Approach

Given two arrays of N integers, print 'Yes' if they have the same elements with same frequencies, else 'No'.

Input

3 1 2 3 3 2 1

Output

YES
solution.py
Loading editor...
Test 1
Test 2
Test 3

Press Run to test your custom input, or Submit to judge against all test cases.

Sign in to continue

Create a free account to run code, submit solutions and track progress.

  • Free forever — no credit card
  • 10+ languages with live execution
  • Points, streaks & leaderboards
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3