ArList.hashmap.hashset.problems
ArList.hashmap.hashset.problems
#### **Basic**
1. **Remove Even Numbers**
Write a method to remove all even numbers from an ArrayList of integers.
*Input:* `[1, 2, 3, 4, 5, 6]`
*Output:* `[1, 3, 5]`
2. **Find Duplicates**
Write a method to find duplicate elements in an ArrayList.
*Input:* `[1, 2, 3, 2, 4, 5, 1]`
*Output:* `[1, 2]`
#### **Medium**
3. **Intersection of Two ArrayLists**
Write a method to return the common elements between two ArrayLists.
*Input:* `[1, 2, 3, 4]` and `[3, 4, 5, 6]`
*Output:* `[3, 4]`
---
#### **Basic**
1. **Count Frequencies**
Given a list of integers, count the frequency of each number using a HashMap.
*Input:* `[1, 2, 2, 3, 3, 3]`
*Output:* `{1=1, 2=2, 3=3}`
#### **Medium**
3. **First Non-Repeating Character**
Find the first non-repeating character in a string using HashMap.
*Input:* `"aabbcddeff"`
*Output:* `'c'`
---
#### **Basic**
1. **Remove Duplicates from ArrayList**
Convert an ArrayList with duplicates into a list with unique elements using
HashSet.
*Input:* `[1, 2, 2, 3, 4, 4, 5]`
*Output:* `[1, 2, 3, 4, 5]`
#### **Medium**
3. **Union and Intersection**
Find the union and intersection of two integer arrays using HashSet.
*Input:* `[1, 2, 3]`, `[2, 3, 4]`
*Output:*
- Union: `[1, 2, 3, 4]`
- Intersection: `[2, 3]`