We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Arrays Problems
1. Merge two sorted arrays into a new array.
2. Check whether a linked list is a palindrome. 3. Find the frequency of characters in a string with a time complexity of O(n). 4. Traverse and reverse an array. 5. Write a function foo(x) that returns 100 if 101 is passed and 101 if 100 is passed, without using if-else. 6. Move zeros to the end of an array, and zeros to the start of an array. 7. Find the most repeated (frequent) number in an array (i.e., Mode). 8. Solve the two-sum problem (e.g., find two numbers in an array that sum to a target value). 9. Find the frequency and index of numbers in an array (e.g., if 5 appears 3 times, list the indices). 10. Find the missing number in an array (e.g., {1, 2, 4, 5} is missing 3). 11. Check whether an array is a palindrome. 12. Find the unique elements in an array. 13. Reverse a string. 14. Calculate the factorial of a number. 15. Write a recursive function. 16. Print values at even indices, and values at odd indices. 17. Find the max and min number in an array, both with and without sorting. 18. Merge two arrays.
Some additional programs to focus on:
Sum of elements in a given array
Largest element in an array Majority element Find the number occurring an odd number of times Find the missing number Merge an array of size n into another array of size m+n Median of two sorted arrays Reverse an array Array rotation Find the smallest and second smallest element in an array Maximum and minimum of an array using minimum comparisons Segregate 0s and 1s in an array Find the two repeating elements in a given array
Also, review sorting algorithm code logic.
You can refer to the following link for assistance, but only solve the problems that are relevant to the above tasks:
The solutions to most of these problems can be found at this link.