Assignment on Data Structure
Assignment on Data Structure
1. Sum of Elements: Write a function that takes an array of numbers and returns the sum of all the
elements.
2. Find Minimum and Maximum: Create a function that returns both the minimum and maximum
values from an array of integers.
3. Count Occurrences: Implement a function that counts how many times a specified element
appears in an array.
4. Merge Two Arrays: Write a function that merges two sorted arrays into a single sorted array.
5. Array Rotation: Develop a function that rotates an array to the left by a given
number of positions.
6. Find Duplicates: Create a function that returns an array of duplicate values from an input array,
without using extra space.
7. Two Sum Problem: Write a function that finds two numbers in an array that sum up to a specific
target value and returns their indices.
8. Move Zeroes: Implement a function that moves all zeroes in an array to the end while maintaining
the order of non-zero elements.
9. Spiral Matrix: Write a function that takes a 2D array (matrix) and returns the elements in a spiral
order.
10. Rotate Image: Given an `n x n` 2D matrix representing an image, rotate the image by
90 degrees clockwise.