Skip to content

khalid586/Preparation

Repository files navigation

Table of Contents

  1. Warm up problems
  2. Binary Search
  3. Tree algorithms
  4. Sweep line technique
  5. Two pointers
  6. Recursion
  7. Dynamic Programming
  8. Basic Data Structures
  9. Greedy Algorithms

Many of the problems have been taken from here

Warm up problems

These problems are taken from TLE eliminators cp sheet

Problem source Status Tags Remarks
CF 1883B 🟢Done Observation Can afford k+1 odd number of characters otherwise not possible to make a palindrome
CF 1904A 🟢Done strings First we have to findout from which places a king can be attacked then from those selected places we will again check if there is such position that also attacks the queen and those final places will be the answer
CF 1878C 🟢Done Math If the target sum lies between minimum and maximum possible sum of k integers then it is "YES" otherwise "NO"
CF 1875A 🟢Done - -
CF 1913B 🟢Done - -
CF 1883C 🟢Done Observation Special check for k = 4
**CF 1855B 🟢Done Observation x consecutive numbers wil always have atleast one divisor from 1 to x

Binary Search

BSTA - Binary Search The Answer

Problem source Status Tags Remarks
Number of segments with big sum(CF EDU) 🟢Done Prefix sum,(lower/upper bounds) -
⭐CSES factory machine 🔴Revisit Binary search -
CF Edu - Binary search 🟢Done Binary search -
CF Edu - Closest to the left 🟢Done Binary search -
CF Edu - Closest to the right 🟢Done Binary search -
CF Edu - packing rectangles 🟢Done Binary search BSTA Check overflow during multiplication
CF Edu - ropes 🟢Done Binary search BSTA increment will be 1e-6
CF Edu - very easy task 🟢Done Binary search BSTA second machine will start only after the first machine has printed a copy
CF 1985F 🟢Done Binary search BSTA Check overflow
⭐Children hoilday 🟢Done Binary search BSTA check

Tree Algorithms

Problem source Status Tags
CSES Subordinates 🔴Revisit DP DP on tree

Sweep Line technique

Problem source Status Remarks
CSES Restaurant Customers 🟢Done Line sweep (Used vector)

Two pointers

Problem source Status Tags Remarks
CF 1265 🔴Revisit two pointer -
**CSES sum of three values 🔴Revisit two pointer Use loop for the first value and two pointers for the rest two values
CF 279B 🔴Revisit two pointer -
Segment with small sum (CF Edu) 🟢Done two pointer Iterate the array with two pointers
CSES Ferris wheel 🟢Done Sorting two pointer -
CSES Playlist 🔴Revisit two pointer sliding window Use two pointers and keep track of the current segment

Recursion

Problem source Status Tags Remarks
Beecrowd 1029 🟢Done recursion -

Dynamic Programming

Problem source Status Tags Remarks
CSES Dice Combinations 🟢Done DP Iterate from the beginning and find out the solution
CSES Minimizing Coins 🟢Done DP Iterative DP
Lucas number (Atcoder) 🟢Done DP Basic iterative DP
Frog 2 (Atcoder) 🟢Done DP Basic iterative DP

Basic Data Structures & Algorithms

Problem source Status Tags Remarks
Beecrowd 1068 🟢Done stack -
Beecrowd 1069 🟢Done stack -
Beecrowd 1566 🟢Done counting sort -

Greedy Algorithm

Problem source Status Tags Remarks
⭐CF 1914D 🔴Using..DP Greedy Sorting -
CSES Missing coin sum 🟢Done Observation After sorting ,if a[i] is less than sum(a[0],a[i-1]) than it is possible to form all numbers from a[0] to sum(a[i-1]) so the missing sum will be sum(a[i-1])+a[i]
CSES Collecting Numbers 🟢Done Greedy check if the previous number has less index or not
CSES Tasks and Deadline 🟢Done sorting Sort tasks according to duration in ascending order
⭐CF 1520E 🟢Done Greedy Have to minimize the sum of non-starred cells