## Prime

Sieve of Eratosthenes -  Given a number n, print all primes smaller than or equal to n. It is also given that n is a small number.  GFG Least prime factor of numbers till n - Given a number n, print least prime factors of all numbers from 1 to n.  GFG  Algo: Use  Sieve of… Continue reading Prime

## Sorting – Set 2

Sorting Set 1  Sorting Set 3  Given an array of n integers. The task is to check whether an arithmetic progression can be formed using all the given elements. If possible print “Yes”, else print “No”. GFG Algo: We don't really need to know the arithmetic difference. We can just take the diff of first two and… Continue reading Sorting – Set 2

## Sorting – Set 1

Sorting Set 2  Sorting Set 3 Given an array of n distinct elements. Check whether the given array is a k sorted array or not. A k sorted array is an array where each element is at most k distance away from its target position in the sorted array. GFG. Algo:  Copy the array into another… Continue reading Sorting – Set 1

## 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

## 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

## Sliding window problem

List of question [Skip] Sliding Window Maximum (Maximum of all subarrays of size k)   - Given an array and an integer k, find the maximum for each and every contiguous subarray of size k. Youtube. We are skipping this question as it the dequeue implementation is tough and not worth the time. It will be difficult… Continue reading Sliding window problem