Sizga butun sonlardan iborat nums massivi berilgan bo'lib, uning uzunligi juft sondir (ya'ni 2 * n).
Massivni har birida o'zaro bir xil ikkita element bo'lgan n ta juftlikka ajratish mumkin bo'lsa true qaytaring, aks holda false qaytaring.
func solve(nums []int) bool {
// ...
}
Input: nums = [3,2,3,2,2,2]
Output: true
Tushuntirish:
6 ta element bor (3 juftlik kerak).
Biz ularni shunday guruhlaymiz: (2, 2), (2, 2), (3, 3).
Barcha juftliklar hosil qilindi, shuning uchun true.
Input: nums = [1,2,3,4]
Output: false
Input: nums = [1, 1]
Output: true
Input: nums = [1, 2, 1, 2, 3, 3, 4, 4]
Output: true