79347793

Date: 2025-01-11 09:13:51
Score: 0.5
Natty:
Report link

This is Typescript solution and it works only for simple types as number, string:

function arrSameElements<T>(arr1: T[], arr2: T[]): boolean {
  if (arr1.length !== arr2.length) {
    return false;
  }

  const arrSet = new Set([...arr1, ...arr2]);
  return arrSet.size === arr1.length;
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Nenad Jeremic