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
Numbers
8 postsGiven a number num (0 < num < 108), the task is to sort the digits of the number such that even indices are in ascending order and odd indices in descending ...read more
Given an Integer Stack in Java, sort the stack in increasing order (Ascending Order) Examples: Input : Stack: [10, 2, 16, 5, 9, 1] Peek: 1 Output : Stack: [1, 2, 5, ...read more
Given an infinite stream of integers, find the k’th largest element at any point of time. It may be assumed that 1 <= k <= n. Example: Input: stream[] = {10, 20, ...read more
Given an array arr[] of N non-negative integers, the task is to sort these integers according to the sum of letters required to represent them. Examples: Input: arr[] = {12, 10, 31, ...read more
Given an array arr[ ] of N non-negative integers, the task is to sort these integers according to sum of their digits. Examples : Input : 12 10 102 31 15 Output ...read more
Given an array of size N. The task is to find the maximum and the minimum element of the array using the minimum number of comparisons. Examples: Input : A[]={4,2,-1,5,0,-5,7,3,6} Output : ...read more
In this article, you will learn to find the roots of a quadratic equation in C programming. Quadratic Equation : In elementary algebra a quadratic equation is an equation in the form ...read more