📜  是双数组 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:08.293000             🧑  作者: Mango

代码示例1
Dual array
  Define a Dual array to be an array where every value occurs exactly twice. For example, {1, 2, 1, 3, 3, 2} is a dual array.The following arrays are not Dual arrays {2, 5, 2, 5, 5} (5 occurs three times instead of two times) {3, 1, 1, 2, 2} (3 occurs once instead of two times) Write a javascript function named isDual that returns 1 if its array argument is a Dual array. Otherwise it returns 0.