Question
C# 1. Given an array and an index, return true if the sum of the first and the last element is equal to the element
C#
1. Given an array and an index, return true if the sum of the first and the last element is equal to the element located at the position index in the array.
public bool SumEqual(int[] array, int index) { }
2. Count and return the smallest number of elements you need to change in the array to make this array a palindrome. The count or zero for null or empty array.
public int PalindromicCount(int[] array) { }
3. Return true if the array can be divided into exactly three partitions, such that the difference between the sum of all the numbers in the left partition and the sum of all the numbers in the right partition is equal to the sum of all the numbers in the middle partition. Because there is no way to know where these partitions are located in the array (i.e., they can occur anywhere), you will need to search for these partitions in the array by brute-force. Since the difference between two numbers can be in any order, you should check for both left right as well as right left.
public bool InEquilibrium(int[] a) { }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started