ARRAY – QUESTIONS
5 questions -CS HUB
SUM OF ELEMENTS IN ARRAY
• **Question Statement:**
• Given an array of integers,
find the sum of all its
elements.
• **Example:**
• Input: arr = [1, 2, 3, 4]
• Output: 10
• **General Intuition:**
• Iterate through the array
and accumulate the sum of
elements.
FIND MIN AND MAX IN ARRAY
• **Question Statement:**
• Find the minimum and
maximum elements in the
given array.
• **Example:**
• Input: arr = [3, 1, 4, 1, 5]
• Output: Min = 1, Max = 5
• **General Intuition:**
• Iterate and keep track of the
smallest and largest values.
CHECK IF ARRAY IS SORTED
• **Question Statement:**
• Check if the given array is
sorted in non-decreasing
order.
• **Example:**
• Input: arr = [1, 2, 3, 4]
• Output: Yes
• **General Intuition:**
• Compare each element
with the next; if any
element is greater, it is not
sorted.
SECOND L ARGEST ELEMENT IN
ARRAY
• **Question Statement:**
• Find the second largest
element in the array.
• **Example:**
• Input: arr = [10, 20, 4, 45,
99]
• Output: 45
• **General Intuition:**
• Track the largest and second
largest values in one pass.
INSERTION AND DELETION IN
ARRAY
• **Question Statement:**
• Perform insertion and deletion
operations in an array.
• **Example:**
• Input: arr = [1, 2, 3], insert 4 at
position 2
• Output after insertion: [1, 4, 2,
3]
• **General Intuition:**
• Shift elements to the right for
insertion, and to the left for
deletion.
SOLVE
1. https://www.geeksforgeeks.org/problems/remove-duplicate
-elements-from-sorted-array/1
2. https://www.geeksforgeeks.org/problems/cyclically-rotate-a
n-array-by-one2614/1
3. https://www.geeksforgeeks.org/problems/missing-number-i
n-array1416/1