Retired
Find all pairs (retired)
166 of 5,124Rubos
Description:
You are given array of integers, your task will be to count all pairs in that array and return their count.
Notes:
- Array can be empty or contain only one value; in this case return
0
- If there are more pairs of a certain number, count each pair only once. E.g.: for
[0, 0, 0, 0]
the return value is2
(= 2 pairs of0
s) - Random tests: maximum array length is 1000, range of values in array is between 0 and 1000
Examples
[1, 2, 5, 6, 5, 2] --> 2
...because there are 2 pairs: 2
and 5
[1, 2, 2, 20, 6, 20, 2, 6, 2] --> 4
...because there are 4 pairs: 2
, 20
, 6
and 2
(again)
Fundamentals
Arrays
Similar Kata:
Stats:
Created | Feb 2, 2019 |
Warriors Trained | 8528 |
Total Skips | 146 |
Total Code Submissions | 18707 |
Total Times Completed | 5124 |
Java Completions | 675 |
JavaScript Completions | 2245 |
PHP Completions | 166 |
Python Completions | 1298 |
Kotlin Completions | 244 |
Ruby Completions | 442 |
C# Completions | 188 |
C Completions | 34 |
Total Stars | 84 |
% of votes with a positive feedback rating | 93% of 710 |
Total "Very Satisfied" Votes | 621 |
Total "Somewhat Satisfied" Votes | 76 |
Total "Not Satisfied" Votes | 13 |
Total Rank Assessments | 58 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 1 kyu |
Lowest Assessed Rank | 8 kyu |