is Graph bipartite? check :)
used bfs to color each node with 0 or 1. every neighbor must have the opposite color. If two adjacent nodes get the same color, the graph is not bipartite. The outer loop handles disconnected components
time complexity: O(V+E)
space complexity: O(V)
so yeah, it's day 3 check of revising DSA, and today was all about binary search + sliding window.
The goal isnโt to solve more problems.
Itโs to make the patterns impossible to forget.
Consistency > intensity.
#DSA#consistency#TechTrends
Day 2 of revision: Arrays, Prefix Sum, Hashing & Binary Search.
Not trying to rush through problems. The goal is to understand the pattern behind the problem,
One problem at a time. One concept at a time.
btw what dsa pattern took you the longest to truly understand?