MCPcopy Create free account
hub / github.com/Hazrat-Ali9/Computer-Programming / getDistinct

Method getDistinct

Problem15.java:31–42  ·  view source on GitHub ↗
(int arr[], int n)

Source from the content-addressed store, hash-verified

29 }
30
31 static String getDistinct(int arr[], int n) {
32 Arrays.sort(arr);
33 String res = "";
34
35 for (int i = 0; i < n; i++) {
36 while (i < n - 1 && arr[i] == arr[i + 1])
37 i++;
38
39 res = res + Integer.toString(arr[i]);
40 }
41 return res;
42 }
43
44 public static void main(String[] args) {
45 // TODO Auto-generated method stub

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected