Replace every array element with the product of every other element without using a division operator
Given an integer array, replace each element with the product of every other element without using the division operator.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven an integer array, replace each element with the product of every other element without using the division operator.
This post discusses std::next_permutation, which can be used to find the lexicographically greater permutations of a string.
Given a binary array containing 0 and 1, find a maximum length subarray with equal numbers of 0’s and 1’s.
Given an integer array, find the maximum length subarray having a given sum.
Given an array of integers, check if the array contains a sub-arrays with 0-sum. Also, prints end-points of all such sub-arrays…
Given two sorted arrays X[] and Y[] of size m and n each where m >= n and X[] has exactly n vacant cells, merge elements of Y[] in their correct position in array X[], i.e., merge (X, Y) by keeping the sorted order.
Given two sorted arrays, X[] and Y[] of size m and n each, merge elements of X[] with elements of array Y[] by maintaining the sorted order, i.e., fill X[] with the first m smallest elements and fill Y[] with remaining elements.
Given an integer array, in-place shuffle it. The algorithm should produce an unbiased permutation, i.e., every permutation is equally likely.
Given an array containing only 0’s, 1’s, and 2’s, sort it in linear time and using constant space.
Given an integer array, rearrange it such that every second element becomes greater than its left and right elements. Assume no duplicate elements are present in the array.
Given a BST, find the floor and ceil of a given key in it. If the given key lies in the BST, then both floor and ceil are equal to that key; otherwise, the ceil is equal to the next greater key (if any) in the BST, and the floor is equal to the previous greater key (if any) in the BST.
Given a BST, find the inorder predecessor of a given key in it. If the key does not lie in the BST, return the previous greater key (if any) present in the BST.