Given an array with n elements, task is to calculate the difference between the sum of those elements occurring at odd indexes and those at even indexes. Note : For the above Read more →
Arrays
106 postsWe have n boxes in which we have to place c magnets such that minimum distance between two magnet should be maximum. As we know any two magnet become aggressive when kept Read more →
Given an array A[] and size of array is N. The task is to replace element of array A[] are in given range L to R both are included. Element replace by Read more →
Given an array in increasing order and a target, return indices of two numbers such that they add up to the target. You have to return an array of indices where the Read more →
Given an array arr[] and the two elements x and y, the task is to find which element(x or y) has highest occurrence in the array. If the occurrences are the same, Read more →
Given an integer array arr[] and K, the task is to count the number of elements ‘A[i]’, such that A[i] * K is also present in the array. Note: If there are Read more →
Given an array arr[] of n elements, write a function to search a given element x in arr[]. Examples: Input : arr[] = {10, 20, 80, 30, 60, 50, 110, 100, 130, Read more →
Given a stock n-day price, you can only trade at most once a day, you can choose to buy a stock or sell a stock or give up the trade today, the Read more →
Given an integer array arr[] and an integer K (greater than 0), the task is to count the subarray whose elements sum up to a multiple of K, else print -1. A Read more →
Given a sorted array arr, remove the duplicates in the array itself such that duplicates appear at most twice in the given array arr and print the new length and modified array Read more →