Thursday, 24 September 2015

Array questions

 
                               Categorized content array

                        
    
    Make larger number 
   Next larger palindrome 
   Least difference in array 
   Print matrix spiral
  Move zeros to the right
  Find repetition multiple sorted arrays
  Largest sum sub array 
  Search in a sorted matrix Kth largest in sorted matrix
  Largest palindrome iterative 
  Reverse words of sentence
  Rotate array k times 
 Merge in single array
 Rotate a string to make another 
  Maximum product subarray
  Maximum sum sub matrix
  Expand the array
  Sort to bring anagrams closer
  Two missing numbers
  Maximize stock profit simple         
  Sum of array except current element
  Maximum arithmetic sequence 
 All elements in kth row are 0 & kth column are 1
Maximum value of sum (i*arr[i]) with only rotations
Given an array of pairs,find all symmetric pairs
Find the largest subarray with 0 sum
Find max of min for every window size in a given array
Find minimum number of coins that make a given value
Collect maximum points in a grid using two traversals
Count distinct element in every window of size K
Search an element in an array where difference between adjacent element is 1
Rotate matrix elements
Find sum of elements in a matrix except the elements in row and/or column of given cell
Find the oppeaing in element in 0(log n) time
Find the elements that oppears once in a sorted array
How to sort a big array with many repetitions
Majoority element
Find a pair with maximum product in array of integers
Find the point where maximum intervals overlap
Generate all possible sorted arrays from alternate elements two given sorted arrays
Count frequencies of elements in array in O(1) extra space and O(n) times
Find the nearest smaller numbers on left side in an array
Sort an an almost sorted array where only two elements are swapped
How to efficiently sort a big list datesin 20's
Find the largest pair sum in an unsorted array
Find union and intersection of two unsorted arrays
Pythagorean triplet in an array
Maximum profit by  buying and selling a share at most twice
Print missing elements that lie in range 0-99
Iterative merge sort
Group multiple occurrence of array elements ordered by first occurrence
Given a sorted and rotated array, find if there is a pair with a given sum
Count number of islands where every island is row-wise and column-wise separated
Rearrange an array such that 'arr[j]' becomes 'i' it 'arr[i]' is 'j'
Find position of  an element in a sorted array of infinite numbers
Find a common element in all rows of a given row-wise sorted matrix
Can Quicksort be implemented in O(nlogn) worst case time complexity
Fill two instances of all numbers from 1 to n in a specific way
Weighted job scheduling
Factorial of a large number
Find the missing number in arithmetic progression
Given a matrix of '0' and 'X', replace '0' with 'X' if surrounded by 'X'
Check if a given array contains duplicate elements with in K distance from each other
Given a binary string, count number of substrings that start and end with 1.
Sort an array in wave from
Given a matrix of' 'O' and 'X' find the largest subsquare surrounded by 'X'
Nuts & bolts problem (Lock and Key problem)
Flood fill algorithm - how to implement fill( ) in paint?
Divide and conquer | set 6 (tiling problem)
Divide and conquer | set 7 ( The skyline problem)
Why is Binary Search preferred over Ternary search?
K'th Smallest/Largest Element in Unsorted Array | Set 3 (Worst Case Linear Time)
Find Index of 0 to be replaced with 1 to get longest continuous sequence of 1s in binary array 
K'th smallest /largest element in unsorted array | set 2 (expected linear time)
K'th smallest /largest element in unsorted array | set 1
Time complexity of insertion sort when they are O(n) inversions?
How to check if two given sets are disjoint?
Minimum number of platforms required for a Railway/Bus Station
Find the closest pair from two sorted arrays
Print all elements in sorted order from row and column wise sorted matrix
Length of the largest subarray with contiguous elements | set1
Given an n x n square matrix find sum of all sub-squares of size k x k
Find common elements in three sorted arrays
Find the first repeating element in an array of integers
Find the smallest positive integers value that cannot be represented as sum of any subset of a given array
rearrange array in alternating positive & negative items with O(1) extra space
Sort an array according to the order defined by another array
Search in an almost sorted array
Maximum sum path in two arrays
Find next greater number with same set of digits
Count number of binary strings with out consecutive 1's 
Find k closest elements to a given value
Create a matrix with alternating rectangles of O and X
Smallest subarray with sum greater than a given value
Remove maximum elements from either side such that 2*min becomes more than max
Divide and conquer | set 6 (Search in a Row-wise and Column-wise sorted 2D arrays)
Bucket sort
Kth smallest element in a Row-wise and Column-wise sorted 2D arrays | set 1
Find the number of zeroes
Find if there is subarray with O sum
Divide and conquer | set 5 (Strassen's matrix multiplication)
Count all possible groups of size 2 or 3 that have sum as multiple of 3
Sort n numbers in range from 0 to n^2-1 in linear time
Rearrange an array so that arr[i] becomes [arr[i]] with O(1) extra space
Suffix Array | Set 1 (introduction)
Count all possible paths from top left to bottom right of a mXn matrix
Count all distinct pairs with differencs equal to k
Find number of pairs such that x^y>y^x
Move all zeroes to end of array
Radix sort
Merge k sorted arrays | set1
Stable marriage problem
Find the minimum element in a sorted and rotated array
Find the increasing subsequence of length there with maximum product
Unbounded binary search example (find the point where a monotonically increasing function becomes positive first time)
Given an array of size n and a number k, find all elements that appear more then n/k times
Print all possible combinations of r elements in a given array of size n
Find a peak element
Sort elements by frequency | set2
Rearrange positive and negative numbers in O(n) and O(1) extra space
Stock buy sell to maximize profit
Find the maximum repeating number in O(n) time and O(1) extra space
Merge overlapping intervals
Counting sort
Dividing and conquer | set 3 (Maximum subarray sum)
Print matrix diagonally
Tug of War
A pancake  sorting problem
Pancake sorting
Dynamic programming | set 27(maximum sum rectangle in a 2D matrix)
Arrange in given numbers to from the biggest number
Find the first circular tour that visits all petrol pumps
Construction of longest monotonically increasing subsequence (N log N)
Find the number of islands
Inplace M x N size matrix transpose | updated
Iterative Quick Sort
Count the number of possible triangles
Shuffle a given array
Print unique rows in a given boolean matrix
Median of two sorted arrays of different sizes
Find the row with maximum number of 1s
Sort a nearly sorted   (or k sorted) array
Find four elements that some to a given value | set 2 (O(n^2Logn) solution)
Find four elements that sum to a given value  | set 1 (n^3 solution)
Dynamic programming | set 20 (maximum length chain of pairs)
Replace every element with the greatest element on right side
Find a pair with the given difference
maximum product subarray
Dynamic programming | set 18 (partition problem)  
Largest subarray with equal number of 0s and 1s
Find a sorted subsequence of size 3 in linear time
Dynamic programming | set 15 (Longest bitonic subsequence)
The celebrity problem
Find the two numbers with odd occurences in an unsorted array
Find the smallest positive number missing from an unsorted array
Find a triplet that sum to a given value
Longest monotonically increasing sub sequence size(N log N)
Dynamic programming set 14 (Maximum sum increasing subsequence)
Find subarray with given sum
Implement two stacks in an array
Minimum number of jumps to reach end
Count smaller elements on right side
Find the maximum element in an array which is first increasing and then decreasing
Maximum length bitonic subarray
Find a fixed point in a given array
Median in a stream of integers (running integers)
A boolean matrix question
Print a given matrix in spiral form
Find the repeating and the missing | added 3 new methods
Find the minimum distance between two numbers
Find whether an array is subset of another array | added method 3
Maximum all subarrays of size k (Added a O(n) method)
Given an array arr[], find the maximum j - i such that arr[j]>arr[i]
Interpolation search vs Binary Search 
Count the number of occurrences in a shorted array
Find the smallest missing number
Check if array elements are consecutive | Added Method 3
Next Greater Element
Which sorting algorithm makes minimum number of memory writes?
Linked list vs array
Equilibrium index of an array
Find duplicates in O(n) time and O(n) extra space

Find the Minimum length Unsorted Subarray, sorting which makes the complete array sorted

Sort an array of  0s, 1s and 2s
Find the two repeating elements in given array
Segregate even and odd numbers
A Product Array Puzzle
Floor and ceiling in a sorted array
Union and Intersection of two sorted arrays
Maximum difference between two elements such that larger element appears after the smaller number
Maximum size square sub-matrix with all 1s
k largest(or smallest) elements in an array | added Min Heap method
Segregate 0s and 1s in an array
Maximum and minimum of an array using minimum number of comparisons
Check for Majority Element in a sorted array
Find the smallest and second smallest element in an array
Two elements whose sum is closest to zero
Count Inversions in an array
Sort elements by frequency | Set 1
Leaders in an array
Maximum sum such that no two elements are adjacent
Block swap algorithm for array rotation
Reversal algorithm for array rotation
Program for array rotation
Write a program to reverse an array
Find the Number Occurring Odd Number of Times

1 comment: