-
Given an array of integers, find if the array contains any duplicates. ContainsDuplicate
-
Given a sorted array arr[] and a number x, write a function that counts the occurrences of x in arr[]. Count-the-number-of-occurrences-in-a-sorted-array
-
Find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum. MaximumSubArray
-
Find the most popular element in int[] array MostFrequentInteger
-
Find all N! permutation of the elements of an array Permutation
-
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. RemoveDuplicatesFromSortedArray
- Do not allocate extra space for another array, you must do this in place with constant memory.
-
Given an integer x and an unsorted array of integers, describe an algorithm to determine whether two of the numbers add up to x. (without hash tables) - containsSum
-
Find the Maximum and minimum of an array using minimum number of comparisons. - MaxMin
-
Given an array of unknown size, reverse the positive numbers (before a negative marker) in the array. Ex: [2, 3, 1, 4,-1...] would become [4, 1, 3, 2, -1...] - SegregatePositiveAndNegativeNumbers
-
Given an array of integers, find two numbers such that they sum up to a specific target. - coupleSum
-
Given that integers are read from a data stream. Find median of elements read so for in efficient way. - MedianMaintenance
-
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit. - best-time-to-buy-and-sell-stock
-
Given an integer array nums, find the contiguous subarray within an array which has the largest product. maximum-product-subarray
-
Given an array nums of
nintegers wheren > 1, return an array output such thatoutput[i]is equal to the product of all the elements of nums exceptnums[i]product-of-array-except-self -
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. Find the minimum element. find-minimum-in-rotated-sorted-array
-
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). - insert-interval
-
Given a collection of intervals, merge all overlapping intervals. - merge-intervals
-
Given a
m x nmatrix, if an element is 0, set its entire row and column to 0. Do itin-place. - set-matrix-zeroes -
You are given an
n x n2D matrix representing an image,inplace. Rotate the image by 90 degrees (clockwise). rotate-image -
Given a matrix of m * n elements (m rows, n columns), return all elements of the matrix in spiral order. - spiralOrderMatrix
-
You are given a square 2D image matrix where each integer represents a pixel. Write a method transposeMatrix to transform the matrix into its Transpose - in-place. - transposeMatrix