Given N and M, distribute first N natural numbers in two sets such that the absolute sum of the numbers in the two sets is equal to M. If possible, print the Read more →
Mathematical
84 postsA sequence, whose nth term is defined by: Tn = (n)2 – (n – 1)2. The task is to calculate the sum of first n term of the sequence i.e find Sn Read more →
Given an array of positive integers we have to find number of pair of elements whose difference is smaller than average difference. Average difference is defined as (max(A)-min(A))/(n-1), where A is the array and Read more →
Given heights of n rectangles and two positive integers x and y. You start moving from the rectangle at 0th index. In one move you can perform one of the following operations: Read more →
Find maximum sum of array A, where k swap can be possible between array A and B. Size of array A and B is N. Examples: Input : N = 5 k Read more →
Given an array arr[] of size N (0 < arr[i] < 106), the task is to find the total count of pairs such that by dividing the largest number by the smallest Read more →
You have a Restaurant and there is a Array nums [ ] of N people outside your restaurant. Your, waiter found out that for each valid i, the i-th person gave Ai Read more →
Given a an array of even size N. The task is to find that is it possible to reorder it in such way so that the sum of left half is not Read more →
Given an integer K and an array of integers, you have to find whether is it possible to reduce the array to a single element equal to k or not. You can Read more →
Given two positive integers. Count the number of pairs (a, b) such that 1 ≤ a ≤ x, 1 ≤ b ≤ y and a+b is even. Examples: Input: 2 7 Output: Count of pairs Read more →