Templates (for CP)

  1. Next smaller element in left and right side of any element - Link    (Can easily modify)
    • Next greater element for both sides in one pass - Link

  2. String Hashing - Link
    • MUST call precalc() inside function

  3. Count inversions in any random array (GENERAL) - Link
    • Count inversions in binary string - Link

  4. Sum of XOR of all subarrays - Link ——₪—— Original question link
  5. Sum of XOR of all subsequence - Link ——₪—— Original question link
  6. Prefix sum of 2-D array - Link

  7. Number of subarrays with sum = k → Link
  8. Number of subarrays with sum divisible by k → Link
  9. Segment Trees → Link
  10. djikstera algorithm - Link
  11. Prime Factorization of given number n → Link
    • Count no. of divisors in O(N) → Link

Comments

Popular posts from this blog

DSA Trees + Heap

Modular Basics + Number Theory + Permutations