Remove Duplicates from Unsorted Array

Given an unsorted array of integers. Write a code to remove duplicates from unsorted array.

For example:

Input   :{5, 1, 2, 6, 4, 4, 5}
Output :{5, 1, 2, 6, 4}

In this example, 4 and 5 appear multiple times in an input array.

In the output, All the duplicates are removed and we have printed only distinct elements of an array.

Find Duplicate Characters in a String | Java Code

Given an input string, Write a java code to find duplicate characters in a String.

For example :

Example 1:

Input    : “Java”
Output : a

The character a appears more than once in a string.

Example 2:

Input : “programming”
Output : m,g,r

These three characters (m, g, r) appears more than once in a string.

Find First Non-repeating Character in a String – Java Code

Write a java program to find first non-repeating character in a string. Given an input string, Write a java code to find first non-repeating character in a string.

For example –

i) Input string – java
Output – j (j is the first non-repeating character)

ii) Input string – web rewrite
Output – b (b is the first non-repeating character)