27th July-5th August 2026

this is august 5th and my ass got detained in COA mini test, i basically missed 2 classes(excluding gt) out of 13 conducted, out of this 3 were gt. I am pumped up, everything is in perfect order, i just gotta push through, i decided today that i need to add college studies in my offcollege hours, this college only deserves 1 hour of my time. FUCK YOU. i have been trying out dp problem and its been nice ride lowkey. Valid bfs this is good fundamental problem, when you have adjacency list, the bfs sequence {a} is given wrt how the adjacency list is arranged, so the problem becomes to first find out how the adjacency list is arranged. how to do that? you have to follow a basic principal index[node]>=index[parent] and index[node+1]>= index[node]
maintain an index vector where you store the index of each node in the bfs sequence, after this, sort the adjacency list wrt to this index vector(make this the comparator function).

        bool comp(ll i, ll j){
            return index[i]< index[j];
        }
        for(ll i=0;i< n;i++){
            sort(adj[i].begin(),adj[i].end(),comp);
        }
        

now make the bfs sequence according to the adjacency list and check if it is same as the given bfs sequence.
thanks to this wonderful guy: Adhish Kancharla he has good graph playlist, yall might follow him for that.

follow my everyday blogs, youre going to witness my life ramming and unfolding infront of your eyes!!

© 2026 My Simple Blog