- Quick Start
- Simple Array of Sum
- Sum of diagonals
- Min Max in Array
- Find Tallest Duplicate
- PlusMinus- Divide the count
- Staircase Upward Downward
- Find Smallest +ve missing number from an array
- Useful Links
This project was generated with Console using Visual Studio 2019 Free Version click to download version 16.8.4
Given an array of integers, find the sum of its elements. Complete the simpleArraySum function in the editor below. It must return the sum of the array elements as an integer. Sample Input
6 1 2 3 4 10 11 Sample Output
31 Explanation 1+2+3+4+10+11 = 31
Given a square matrix, calculate the absolute difference between the sums of its diagonals. Given in a List<List> find the diagonal sum from Left to right and Right to Left. Sample Input 1 2 3 4 5 6 7 8 9
Sample Output 0 Explanation Sum everything from 1+5+9=15 and 3+5+7=15 (15-15)=0
Simple MinMaxSum in given array. Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers. Sample Input
1 2 3 4 5 Sample Output
10 14 Explanation Sum everything 1 except , the sum is =14. Sum everything 2 except , the sum is =13. Sum everything 3 except , the sum is =12. Sum everything 4 except , the sum is =11. Sum everything 5 except , the sum is =10.
Count how many candles are tallest in a given array which are repeated or duplicates.
Sample Input 3 2 1 3 Sample Output 2 Explanation Candle heights are . The tallest candles are units, and there are of them.
Given an array of integers, calculate the ratios of its elements that are positive, negative, and zero. Print the decimal value of each fraction on a new line with 6 places after the decimal.
Sample Input
arr[] size n = 6
arr = [-4, 3, -9, 0, 4, 1]
Sample Output 0.500000 0.333333 0.166667
Explanation There are 3 positive numbers, negative 2 numbers, and 1 zero in the array. The proportions of occurrence are positive:3/6=0.500000 , negative:2/6=0.333333 and zeros: 1/6=0.166667.
This is a staircase of size n:6 Sample Input 6
Sample Output # ##
Explanation The staircase is right-aligned, composed of # symbols and spaces, and has a height and width of .
array of size n Sample Input [1, 2, 3, 4, 5]
Sample Output 6
Explanation The binary search, find the middle index is in the right position, to decide whether missing element in left half or right half.