DSA QUESTIONS
Arrays
1. Find the Largest Element: Write a function to find the largest element in an
array.
2. Find the Smallest Element: Write a function to find the smallest element in
an array.
3. Sum of All Elements: Calculate the sum of all elements in an array.
4. Reverse an Array: Write a function to reverse the order of elements in an
array.
5. Find the Second Largest Element: Write a function to find the second
largest element in an array.
6. Find the Second Smallest Element: Write a function to find the second
smallest element in an array.
7. Check if Array is Sorted: Write a function to check if an array is sorted in
ascending order.
8. Remove Duplicates: Write a function to remove duplicate elements from an
array.
9. Find the Missing Number: Given an array of n-1 elements in the range of 1
to n, write a function to find the missing number.
10. Find the Duplicate Number: Given an array of n+1 elements in the range of
1 to n, write a function to find the duplicate number.
11. Find the Intersection of Two Arrays: Write a function to find the common
elements between two arrays.
12. Find the Union of Two Arrays: Write a function to find all unique elements
present in two arrays.
13. Move Zeros to End: Write a function to move all zeros in an array to the end
while maintaining the order of non-zero elements.
14. Find the Majority Element: Write a function to find the element that appears
more than half the time in an array.
15. Find the Element that Appears Once: Write a function to find the element
that appears only once in an array where every other element appears
twice.