Given an integer array a[] of size N and a target sum K, subtract a number from each element such that each element becomes X ( if an element is less than Read more →
Arrays
106 postsLeetcode Hard Problem, Simplest Solution Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should Read more →
Given an integer array arr[] (0 < arr[i] < 106) of size N, the task is to find the LCM of unique elements of the array. If there is no unique element Read more →
Given an array of positive integers you can reshuffle the array and construct a new array on which we can perform operation X on it the elements we receive must be in Read more →
Generate an array A, such that gcd of all its contiguous subarray is present in the given array G. If it is not possible to generate such an array then print -1. Read more →
Given N coins initially all tails up (let say represented by ‘0’) and a number of queries Q. There are two types of queries. Update: 1) Given indices of a range [L, Read more →
You are given two boxes. The first box is empty while in the second, there are 3 piles of coins. Whenever you choose a pile of X coins (x>=1) from the second Read more →
Given two natural numbers N1 and N2.The task is to find the maximum possible sum after swapping of a single digit between two given natural numbers. Examples : Input : N1=123 N2=998 Read more →
You are given an integer array which is sorted in non-decreasing order. Build and return an integer array result with the same length as the integer array such that result[i] is equal Read more →
Given an array of N elements. You have to partition the array into two non-empty subarrays such that every number in the right subarray is strictly greater than every number in the Read more →