Challenge: Conversion and Traversal
Complete the conversion of an array and tree traversal challenge.
We'll cover the following
Convert an array to a set
Write a Java program to convert an array into a set and then display it.
The arr
is an input parameter for which your code must return the appropriate output on the screen. The returned value must be in ascending order.
For example:
Let’s say you have the array brr
as follows:
int brr[] = {2, 2, 2, 2};
After converting brr
into the set, the code should return the following:
2
The output is 2
because the set doesn’t allow duplicates.
Note: Don’t worry if you need help. You can see the solution by pressing the “Show Solution” button.
Get hands-on with 1400+ tech skills courses.