Блог пользователя adaptatron

Автор adaptatron, 5 месяцев назад, По-английски

Given a permutation, compute the unique MEX across all subarrays. Then, reverse the problem, given a binary string where a $$$1$$$ at index $$$i$$$ means that a subarray with MEX $$$i$$$ exists (and $$$0$$$ means it doesn't), compute the number of permutations that satisfy these constraints.

I created a video discussing the ideas to solve both the problem in $$$O(N)$$$. Practice Problem

Video https://youtu.be/78N9JfaQ72g

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I created a video discussing DP on Trees, Expected Value and Greedy strategies to solve E. Coloring a Red Black Tree from last Codeforces Div2 round.

Video Link: https://youtu.be/EAODhN-zthA

Полный текст и комментарии »

  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

Given an array, compute the prefix maxima array and remove all the duplicates. How many subsequences of the original array can you create such that the prefix maxima of the subsequence is equal to the prefix maxima of the original array (after removing the duplicates from both)?

I created a video to solve this problem in $$$O(N \cdot Log(N))$$$.

https://youtu.be/3VQtW8lnEvQ

Practice Problem

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I created a video brainstorming problem C. Interval Mod from today's Codeforces Div2 round. It discusses some ideas that you can apply on problems that involve operations on a subarray.

Video Link: https://youtu.be/nZ5U43GGlyc

Полный текст и комментарии »

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I created a video that talks about some bit manipulation tricks, and how to apply horner's trick to binary search the starting element that produces a geometric series sum. This is also the editorial for D. RReeppeettiittiioonn from today's Codeforces round.

Video https://youtu.be/4MsjyCriVGU

Полный текст и комментарии »

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

Everyone knows the classical Dynamic Programming problem of finding the max profit path in a grid. But can you quickly find out the maximum profit when I change an arbitrary cell's value? I discuss an anti diagonal trick that can be used to solve such problems. This idea appeared in a recent Div 2 contest, E. The Turtle Strikes Back

Video https://youtu.be/ms8douXze4E

Полный текст и комментарии »

  • Проголосовать: нравится
  • +13
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I created a video talking about Dynamic Programming on Trees in context of problem H. Closer from last Div2 round. It also talks about why iterating over all the grandchildren is actually $$$O(N^2)$$$ instead of $$$O(N^3)$$$.

Video Link: https://youtu.be/9opfwMW0wWw

Полный текст и комментарии »

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

Problem G. Down the Pivot had an interesting subproblem, given a tree where nodes contain 0 or 1, in one operation, you are allowed to select one downward path and flip it. What is the minimum number of operations required to set all nodes to 0?

So I created a video discussing 3 techniques:

  • Minimum operations when you are allowed to flip a subarray.
  • Minimum operations when you are allowed to flip a subtree.
  • Minimum operations when you are allowed to flip a downward path.

https://youtu.be/ekhPwtSgY_g

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

In continuation of my last video, where we talked about a problem that transitioned from Game theory to Bitmask DP, I uploaded a video that talks about the transition from bitmask to Combinatorics (which is essentially the hard version of the previous problem).

Video https://youtu.be/O-zszo57B54

Practice Problem: E2. Prime Gaming (Hard Version)

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I created a video on a game theory problem that can be solved via Bitmask DP and Minimax DP.

Video Link : https://youtu.be/tSJgBJkfT94

Practice Problem: Easy Version and Hard Version

Полный текст и комментарии »

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

Given a grid with $$$R \leq 10^5$$$ rows and $$$C \leq 10^5$$$ columns, there are $$$Q \leq 10^3$$$ obstacles on the grid. You need to find the number of path from $$$(1, 1)$$$ to $$$(R, C)$$$ that do not go through any obstacle.

I created a video on this classical problem https://youtu.be/i74DlMrPuQk

Practice Problem

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

Problem F. Interval Game from today's Codeforces Div2 round required the simplication of a complex game down to a Nim game, so I created a video talking about how to identify hidden Nim heaps in this problem.

https://youtu.be/lTEARmp_av0

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I created a video on a famous Leetcode problem that reappeared in a recent Codeforces round. The Discuss section of the Leetcode problem has only DP based approach, but the Codeforces comment section has other interpretations as well, so I decided to create a video around it).

https://youtu.be/ayoOFNC91L8

Practice Problem : Non-Descending Arrays

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I created a video on 3 different techniques to count distinct subsequences of a string.

  • $$$O(N^3)$$$ Lexicographic Minimal DP on Indices
  • $$$O(N^2)$$$ Lexicographic Maximal Character DP
  • $$$O(N^2)$$$ Lexicographic Maximal PIE DP

Video https://youtu.be/DZ8sVn4W6IQ

Practice Problem H. Subsequences (hard version)

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I created a video on Cartesian trees in the context of the problem D. Simons and Beating Peaks from a recent Codeforces round.

https://youtu.be/1jMKUJG9RU4

Полный текст и комментарии »

  • Проголосовать: нравится
  • +15
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

Alice and Bob are playing a game with a fixed array and a dynamic array. In one round, Alice can remove an element $$$y$$$ from the dynamic array if $$$y \% fixed[i] = 0$$$ for some $$$i$$$. And Bob can remove this element if $$$y \% fixed[i] \neq 0$$$. The first player to run out of moves loses. Find out who the winner is.

I created a video on this interesting problem that intersects with game theory and number theory.

https://youtu.be/rlrHg6nJxMI

Полный текст и комментарии »

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

Find how many string pairs are there in array such that at least one permutation of their concatentation is a palindrome.

I created a video discussing the technique to solve this in $$$O(N \cdot Log(N))$$$.

https://youtu.be/OufI-e0CeJU

Полный текст и комментарии »

  • Проголосовать: нравится
  • +15
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I created a video discussing some techniques related to Bit manipulation, greedy algorithms, 2 pointers and observation skills in the context of problem F. Shrink and Reverse from Codeforces Educational Round 162.

https://youtu.be/ixJKfCEYWEw

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I made a video on a Combinatorics and Number theory problem which asks you to compute the number of arrays of length N where the LCM of all elements is equal to K.

https://youtu.be/lGIShsw3KVE

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I made a video on the Codeforces classic problem Slimes that starts out with a Greedy approach, and then incrementally adds a data structure and an algorithm to optimise it.

https://youtu.be/9XhtHM3l6i4

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

For every substring $$$[L, R]$$$, count the number of substrings that have an equal number of 0s and 1s. Then print the sum over all possible $$$[L, R]$$$.

I made a video discussing ideas to solve this problem. https://youtu.be/LWJ7jKnqi9k

Practice problem https://codeforces.me/problemset/problem/1996/E

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I created a video that discusses how to figure out if $$$a[i]$$$ can be part of some (not necessarily all) LIS (Longest Increasing Subsequence).

Video link: https://youtu.be/oBfCGsZwh1Y

Practice Problem : https://atcoder.jp/contests/abc354/tasks/abc354_f

Полный текст и комментарии »

  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

Created a video on a fact that might not be known to some: How to efficiently compute minimum XOR pair of an array.

Video link : https://youtu.be/j_4XLIUrYoI

Here's a contest containing the applications of this idea

https://codeforces.me/group/7Dn3ObOpau/contest/503551

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I made a video discussing the key idea behind problem F. A Simple problem from last Codeforces round.

Video link : https://youtu.be/uKtZd7Oedcc

Полный текст и комментарии »

  • Проголосовать: нравится
  • +16
  • Проголосовать: не нравится

Автор adaptatron, 5 месяцев назад, По-английски

I made a video discussing how to approach vague graph problems ft. Problem F — Strongly Connected 2 from last Atcoder Beginner Contest 450.

Video Link : https://youtu.be/ItpQbShFFEE

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится