Find the minimum index of a repeating element in an array
Given an integer array, find the minimum index of a repeating element in linear time and doing just one traversal of the array.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven an integer array, find the minimum index of a repeating element in linear time and doing just one traversal of the array.
Given a sorted integer array, find a pair in it having an absolute minimum sum.
Given a binary tree, efficiently clone of it.
Given two sorted integer arrays, merge them into a single array in decreasing order, and return it. In other words, merge two sorted arrays from their end.
Given two integer arrays, each of which is sorted in increasing order, merge them into a single array in increasing order, and return it.
Given an integer array, find the index of the maximum occurring element with an equal probability.
Given an M × N rectangular grid, efficiently count all paths starting from the first cell (0, 0) to the last cell (M-1, N-1). We can either move down or move towards right from a cell.
Given a positive number, find the square root of it. If the number is not a perfect square, then return the floor of its square root.
Given a monotonically increasing function f(x) on the non-negative integers, find the value of x, where f(x) becomes positive for the first time. In other words, find a positive integer x such that f(x-1), f(x-2), … are negative and f(x+1), f(x+2), … are positive.
Write an efficient algorithm to find the longest common prefix (LCP) between a given set of strings.
This post will discuss how to reverse an array in C++.
Given a binary tree whose nodes are labeled from 0 to N-1, construct an N × N ancestor matrix. An ancestor matrix is a boolean matrix, whose cell (i, j) is true if i is an ancestor of j in the binary tree.