KEMBAR78
Array Questions | PDF
0% found this document useful (0 votes)
11 views2 pages

Array Questions

Uploaded by

sujatabadiger232
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)
11 views2 pages

Array Questions

Uploaded by

sujatabadiger232
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

1.

Given an array of even numbers, check whether it is possible to divide the array into
subarrays such that the sum of each subarray equals the average sum of elements of the
entire array. If such a division exists, return true; otherwise, return false.

2. In a magical kingdom, the wizard Arithmo needs your help to find "Perfect Numbers." A
perfect number is defined as a number that is equal to the sum of its proper divisors
(excluding itself). Write a program to check whether a given number is a perfect number
or not

3. Given an integer array nums, find the count of pairs (i, j) where i < j and nums[i] -
nums[j] = k.

4. Given an integer array and a target value, find all pairs of elements where the difference
between the elements is equal to the target. Return the list of such pairs.

5. Write a program to find and print all strong numbers from a given integer array. A strong
number is defined as a number equal to the sum of the factorial of its digits.

6. Given an array of integer values, find all empty packets (represented by 0 push them to
the end of the array.

7. Rotate an array to the right K times and print the result.

8. Find the element that appears only once in an array where every other element appears
twice.

9. Given an array of integers and an integer sum return the total number of subarrays whose
sum equals the given value.

10. Given an integer array nums find the subarray with the largest sum and return its sum
11. Given an integer array arr, find the count of elements whose value is greater than all of its
prior elements.

12. Check if there are any duplicates in an array.

13. Determine if a given array is sorted in non-decreasing order.

14. Write a program to find the count of numbers which consists of unique digits. Input:
Input consist of two Integer lower and upper value of an range

15. There is a range given n and m in which we have to find the count all the prime pairs
whose difference is 6. We have to find how many sets are there within a given range.

16. Given a square matrix, calculate the absolute difference between the sums of its
diagonals. 1 2 3 4 5 6 9 8 9 The left-to-right diagonal = 1+5+9 = 15; The right to left
diagonal = 3+5+9 = 17; Their absolute difference is |15- 17| = 2

You might also like