Find the smallest missing element from a sorted array
Given a sorted array of distinct non-negative integers, find the smallest missing element in it.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a sorted array of distinct non-negative integers, find the smallest missing element in it.
Given a string, print it backwards using recursion.
Given a circularly sorted integer array, find the total number of times the array is rotated. Assume there are no duplicates in the array, and the rotation is in the anti-clockwise direction.
Given a sorted array of n integers and a target value, determine if the target exists in the array or not in logarithmic time. If the target exists in the array, print an index of it.
Given a sorted array of n integers and a target value, determine if the target exists in the array or not in logarithmic time using the binary search algorithm. If target exists in the array, print the index of it.
An island is in the form of a square matrix, and a person is standing inside the matrix. The person can move one step in any direction (right, left, top, down) in the matrix. Calculate the probability that the person is alive after walking n steps on the island, provided that he dies if he steps outside the matrix.
Given an M × N binary matrix, replace all occurrences of 0’s by 1’s, which are not completely surrounded by 1’s from all sides (top, left, bottom, right, top-left, top-right, bottom-left, and bottom-right).
Given an M × N matrix, find all paths from the first cell to the last cell. We can only move down or to the right from the current cell.
Given an N × N matrix of positive integers, find the shortest path from the first cell of the matrix to its last cell that satisfies given constraints.
Given an M × N matrix, print the matrix in spiral order.
Flood fill (also known as seed fill) is an algorithm that determines the area connected to a given node in a multi-dimensional array.
Given an M × N matrix of characters, find all occurrences of a given string in the matrix. We are allowed to search the string in all eight possible directions. Note that there should not be any cycles in the output path.