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


Random Problem Set

Check if two rectangles overlap - instead of checking if they overlap we check if a rectangle lies outside. So we check if a rectangle lies on the right,left, top or bottom of the first rectangle. If it lies outside then don't overlap. Else they overlap.  SO Amazon: Count Negative Integers in Matrix - Numbers… Continue reading Random Problem Set