#K66762. Check Permutation
Check Permutation
Check Permutation
Given two lists of integers, determine whether they are permutations of each other. Two lists are considered permutations if they contain the same elements with identical frequencies.
In mathematical terms, let \(A\) and \(B\) be two arrays. They are permutations of each other if \(|A| = |B|\) and for every integer \(x\), the number of times \(x\) appears in \(A\) is equal to the number of times it appears in \(B\), i.e., \(\text{count}_A(x) = \text{count}_B(x)\).
inputFormat
The input consists of two lines from standard input. The first line contains space-separated integers representing the first list (nums1), and the second line contains space-separated integers representing the second list (nums2). An empty line denotes an empty list.
outputFormat
Output a single word to standard output: True
if the two lists are permutations of each other, and False
otherwise.
1 2 3 4
2 1 4 3
True