0% found this document useful (0 votes)
2 views2 pages

1D_Arrays_Practice_Sheet

The document is a practice sheet for 1D arrays, categorized into easy, medium, and hard problems. It includes tasks such as input/output of arrays, finding maximum and minimum elements, sorting, and handling duplicates. The challenges range from basic operations to more complex algorithms like Kadane's and merging sorted arrays.

Uploaded by

honeybeebiotics
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

1D_Arrays_Practice_Sheet

The document is a practice sheet for 1D arrays, categorized into easy, medium, and hard problems. It includes tasks such as input/output of arrays, finding maximum and minimum elements, sorting, and handling duplicates. The challenges range from basic operations to more complex algorithms like Kadane's and merging sorted arrays.

Uploaded by

honeybeebiotics
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1D Arrays Practice Sheet

Easy
1. Input and Output of Array
Take input of n elements in an array and print them.
2. Sum of Array Elements
Calculate the sum of all elements in an array.
3. Find Maximum Element
Find the largest element in the array.
4. Find Minimum Element
Find the smallest element in the array.
5. Search Element
Search for a given element and print its index (or -1 if not found).
6. Count Even and Odd
Count the number of even and odd numbers in the array.
7. Reverse Array
Reverse the elements of the array in-place.

Medium
1. Second Largest Element
Find the second largest element in an array.
2. Sort Array (Bubble Sort)
Sort an array using the bubble sort algorithm.
3. Remove Duplicates
Remove duplicate elements from an array.
4. Frequency of Elements
Print the frequency of each unique element in the array.
5. Left Rotate Array by One
Rotate the array left by one position.
6. Right Rotate Array by K
Rotate the array right by K positions.
7. Check Palindromic Array
Check whether the array is a palindrome (same forward and backward).
Hard
1. Find Unique Element
Given an array where every element appears twice except one, find that unique element.
2. Pair Sum
Find all pairs in the array that sum to a given target value.
3. Subarray with Given Sum
Find a continuous subarray whose sum equals a given number.
4. Maximum Subarray (Kadane's Algorithm)
Find the contiguous subarray with the maximum sum.
5. Trapping Rain Water
Given heights of bars, calculate the amount of trapped rain water.
6. Merge Two Sorted Arrays
Merge two sorted arrays into a single sorted array.
7. Move Zeros to End
Move all zero elements to the end while maintaining the order of non-zero elements.

You might also like