Basic Operations (1-20)
1. Input n elements in an array and display them.
2. Find the sum of all elements in an array.
3. Find the average (mean) of all elements in an array.
4. Find the maximum and minimum values in an array.
5. Find the second largest element in an array.
6. Find the second smallest element in an array.
7. Count the number of even and odd numbers in an array.
8. Count the number of positive and negative numbers in an array.
9. Reverse an array without using an extra array.
10. Reverse an array using another array.
11. Copy elements from one array to another.
12. Swap the first and last elements of an array.
13. Find the sum of only even numbers in an array.
14. Find the sum of only odd numbers in an array.
15. Find the product of all elements in an array.
16. Find the difference between the largest and smallest elements in
an array.
17. Replace all negative numbers with zero.
18. Find the cumulative sum of an array (prefix sum).
19. Calculate the moving average of the last k elements in an array.
20. Count the number of elements greater than a given value.
Searching (21-40)
21. Search for a given number in an array (Linear Search).
22. Search for a number using Binary Search (array must be sorted).
23. Count the occurrences of a specific number in an array.
24. Find the index of the first occurrence of a number in an array.
25. Find the index of the last occurrence of a number in an array.
26. Check if an array is sorted in ascending order.
27. Check if an array is sorted in descending order.
28. Find all numbers in an array greater than a given number.
29. Find all numbers in an array smaller than a given number.
30. Find all numbers within a given range in an array.
31. Find the closest value to a given number in an array.
32. Find the largest prime number in an array.
33. Find the smallest prime number in an array.
34. Find the largest palindrome number in an array.
35. Find the most frequent element in an array.
36. Find the least frequent element in an array.
37. Find the mode (most repeated element) in an array.
38. Check if two arrays are equal (element-wise comparison).
39. Find two numbers in an array whose sum is equal to a given
value.
40. Find if there exists a duplicate in the array.
Sorting (41-60)
41. Sort an array in ascending order (Bubble Sort).
42. Sort an array in descending order (Bubble Sort).
43. Sort an array in ascending order (Selection Sort).
44. Sort an array in descending order (Selection Sort).
45. Sort an array using the Insertion Sort algorithm.
46. Sort an array using Merge Sort.
47. Sort an array using Quick Sort.
48. Sort an array in ascending order using std::sort().
49. Sort an array in descending order using std::sort().
50. Sort only even numbers in an array while keeping odd numbers
unchanged.
51. Sort an array such that all even numbers appear before odd
numbers.
52. Sort an array such that all negative numbers appear before
positive numbers.
53. Sort an array such that all zeros come at the end.
54. Find the kth smallest element in an array.
55. Find the kth largest element in an array.
56. Merge two sorted arrays into a single sorted array.
57. Merge two unsorted arrays and sort the final array.
58. Find the median of an unsorted array.
59. Find the median of a sorted array.
60. Find the third largest element in an array.
Modifications and Manipulations (61-80)
61. Remove duplicate elements from an array.
62. Remove all occurrences of a given number from an array.
63. Insert an element at a given position in an array.
64. Delete an element at a given position in an array.
65. Rotate an array to the left by one position.
66. Rotate an array to the right by one position.
67. Rotate an array to the left by k positions.
68. Rotate an array to the right by k positions.
69. Swap adjacent elements in an array.
70. Find the largest sum of any contiguous subarray (Kadane’s
Algorithm).
71. Find the largest product of any contiguous subarray.
72. Find the smallest sum of any contiguous subarray.
73. Find the sum of all subarrays.
74. Find the product of all subarrays.
75. Find the XOR of all elements in an array.
76. Find the AND of all elements in an array.
77. Find the OR of all elements in an array.
78. Replace every element with the product of all other elements
(without division).
79. Find the missing number in a given sequence of 1 to n.
80. Find the duplicate number in an array where only one number is
repeated.
Advanced Mathematical Operations (81-100)
81. Find the Greatest Common Divisor (GCD) of all elements in an
array.
82. Find the Least Common Multiple (LCM) of all elements in an array.
83. Find the Fibonacci numbers in an array.
84. Find all Armstrong numbers in an array.
85. Count the number of prime numbers in an array.
86. Count the number of composite numbers in an array.
87. Find the sum of all prime numbers in an array.
88. Find the sum of squares of all elements in an array.
89. Find the sum of cubes of all elements in an array.
90. Find the sum of the digits of all elements in an array.
91. Find the factorial of all numbers in an array.
92. Convert all numbers in an array to their binary representation.
93. Convert all numbers in an array to their hexadecimal
representation.
94. Count the number of palindrome numbers in an array.
95. Find the largest power of 2 in an array.
96. Find the longest consecutive subsequence in an array.
97. Find the first missing positive number in an array.
98. Find all Pythagorean triplets in an array.
99. Find the sum of alternating elements (sum of even-indexed
minus odd-indexed elements).
100. Check if an array is a palindrome (same forward and backward).