Pinned Tweet
Yesterday I wore an article on how my last week went
Its is posted on LinkedIn
linkedin.com/posts/ogochukwu…
Magazine = inventory. Letter = demand. Every required character simply decrements its available count. #algorithms #hashtables Watch: youtube.com/watch?v=bLHsVKCY…
M='aabc' becomes inventory: a→2, b→1, c→1. We no longer care where the characters are — only how many remain. #hashtables #python Watch: youtube.com/watch?v=bLHsVKCY…
Brute force asks: where is another unused character? Optimized asks: how many do I have left? That shift changes the whole solution. #hashtables #algorithms Watch: youtube.com/watch?v=bLHsVKCY…
Bad inventory flow: search stock records again for every unit. Better flow: item → available count → decrement. Same optimization idea. #softwareengineering Watch: youtube.com/watch?v=nK0kLzU4…
We track used positions, but what we really need is available quantity by character. That is the clue toward hashing. #hashtables #optimization Watch: youtube.com/watch?v=nK0kLzU4…
Worst case, used stores every magazine index. That gives O(M) auxiliary space. #python #bigO Watch: youtube.com/watch?v=nK0kLzU4…
If L ≈ M ≈ n, then O(L × M) becomes O(n²). Repeated scans create the quadratic growth. #algorithms Watch: youtube.com/watch?v=nK0kLzU4…
Why O(L × M)? Every required character in L may trigger a full scan through M. #algorithms #bigO Watch: youtube.com/watch?v=nK0kLzU4…
The code is correct, but every requirement can trigger another scan. Correctness and efficiency are two different questions. #algorithms Watch: youtube.com/watch?v=NC2-2qC-…
Second 'a': index 0 matches but is already used, so the search continues to index 1. #python #algorithms Watch: youtube.com/watch?v=NC2-2qC-…
Next requirement, inner loop starts again. The debugger makes the repeated magazine scan obvious. #algorithms #optimization Watch: youtube.com/watch?v=NC2-2qC-…
First 'a': match M[0] → add 0 to used → found=True → break. One requirement consumes one copy. #python #debugging Watch: youtube.com/watch?v=NC2-2qC-…
Debugger focus: char_l, j, used, found. Those 4 values show the entire brute-force search at runtime. #python #debugging Watch: youtube.com/watch?v=NC2-2qC-…
The code is correct, but every requirement can trigger another scan. Correctness and efficiency are two different questions. #algorithms Watch: youtube.com/watch?v=ZHrTOxom…
Second 'a': index 0 matches but is already used, so the search continues to index 1. #python #algorithms Watch: youtube.com/watch?v=ZHrTOxom…
Next requirement, inner loop starts again. The debugger makes the repeated magazine scan obvious. #algorithms #optimization Watch: youtube.com/watch?v=ZHrTOxom…
Debugger focus: char_l, j, used, found. Those 4 values show the entire brute-force search at runtime. #python #debugging Watch: youtube.com/watch?v=ZHrTOxom…
First 'a': match M[0] → add 0 to used → found=True → break. One requirement consumes one copy. #python #debugging Watch: youtube.com/watch?v=ZHrTOxom…
No available copy after the scan? Return False immediately. If a mandatory resource can't be fulfilled, the whole request fails. #algorithms #softwareengineering
Inner loop: scan → unused match → reserve index → break. One requirement consumes exactly one magazine character. #python #algorithms
