CP problems of important topics
- if not equal char in map then add an edge with weight=1, else weight=0
- check neighbours and apply 0-1 BFS to find path with min 1's
- Alternative approach Dijkstra.
- for given edge add 0 in x->y direction
- add 1 in reverse y->x direction (not given edge)
- apply 0-1 BFS to get a directed shortest path from 1 to n.
- find minimum time when making p number of parathas is possible
- so monotonic seq of F F F F T T ..... find the first true
- set max as (p*(p+1)/2) * maximum val in array
- use BS with predicate function keeping number of parathas as constraint.
- Try traversing from maximum value nodes (multisource BFS)
- Count the number of levels until it exhausts
- return level-1 (no of edges till deepest node reqd only)
- Classic MST
- take log of weights and add them
- cost+1 will give total number of divisors
-
Topo sort first
-
dp[v]= edge u→v exists ∑ dp[u],
-
dp[1]=1