id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

frew@mclean.com > numUniquePairs
prev  |  next  |  chance

Given an array of N elements, the task is to find all the unique pairs that can be formed using the elements of a given array. Input: arr[] = {1, 1, 2} Output: 4 (1, 1), (1, 2), (2, 1), (2, 2) are the only possible pairs.


numUniquePairs([1, 2, 3, 2, 4, 5, 4]) → 25
numUniquePairs([]) → 0
numUniquePairs([-3, 3]) → 4

...Save, Compile, Run (ctrl-enter)

public int numUniquePairs(int[] nums) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy