## Greedy Algo

Minimum Number of Platforms Required for a Railway/Bus Station.Given arrival and departure times of all trains that reach a railway station, find the minimum number of platforms required for the railway station so that no train waits. We are given two arrays which represent arrival and departure times of trains that stop  GFS. Also: We… Continue reading Greedy Algo

## Array – Java

Very basic way to use java array - You can either use array declaration or array literal (but only when you declare and affect the variable right away, array literals cannot be used for re-assigning an array).For primitive types: int[] myIntArray = new int[3]; int[] myIntArray = {1,2,3}; int[] myIntArray = new int[]{1,2,3}; For classes,… Continue reading Array – Java

## Pending

find median of sorted array Print all combinations of points that can compose a given number Print all possible sums of consecutive numbers with sum N Given an array of n integers. Find the maximum value of arr[i] mod arr[j] where arr[i] >= arr[j] and 1 <= i, j <= n Find a Fixed… Continue reading Pending

## Array – Set 1

Array - Set 2  More Array Problems -  1 , 2 General Direction For Thinking for Array Problem – 1.  Brute force is the obvious one and should be instant response 2.  Sorting (multiple pointers when sorting is also useful | sometimes search after sort ) 3.  Hash When we are given condition like numbers are in… Continue reading Array – Set 1

## Array Set 2

Array Set 1 [SKIP] Find the element that appears once Given an array where every element occurs three times, except one element which occurs only once. Find the element that occurs once. Expected time complexity is O(n) and O(1) extra space. GFS Find a sorted subsequence of size 3 in linear time Given an array… Continue reading Array Set 2

## Imp Random Problem

Suppose I'm given a large dictionary in flat file with 200 million words and my function needs to check the existence of any given word in the dictionary, what's the fastest way to do it? You can't store the dictionary in the memory because you only have 1GB of memory. You can store it in… Continue reading Imp Random Problem