View Posts

  • Leet Code Solution 4 - Median of Two Sorted Arrays

    |
    Updated at

    4. Median of Two Sorted Arrays, Hard

    Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.


    The overall run time complexity should be O(log (m+n)).

    Solution, Typescript

    function findMedianSortedArrays(nums1: number[], nums2: number[]): number {
    let medianIdx = [];
    let totalCount = nums1.length + nums2.length;

    let firstMedianIdx = Math.floor(totalCount / 2);
    if(totalCount % 2 == 0) {
    medianIdx.push(firstMedianIdx-1);
    medianIdx....
  • Leet Code Solution 987 - Vertical Order Traversal of a Binary Tree

    |
    Updated at

    987. Vertical Order Traversal of a Binary Tree, Hard

    Given the root of a binary tree, calculate the vertical order traversal of the binary tree.


    For each node at position (row, col), its left and right children will be at positions (row + 1, col - 1) and (row + 1, col + 1) respectively. The root of the tree is at (0, 0).


    The vertical order traversal of a binary tree is a list of top-to-bottom orderings for each column index starting from the leftmost column and ending on the rightmost column. There may be mult...

  • Leet Code Solution 9 - Palindrome Number

    |
    Updated at

    Palindrome Number

    Given an integer x, return true if x is a palindrome, and false otherwise.

    Solution, Typescript

    function isPalindrome(x: number): boolean {
    if(x < 0) {
    return false;
    }

    let remainder = x;
    let placeValue = 1;
    let val = 0;
    while(remainder > 0) {
    let digit = remainder % 10;
    val = val * 10 + digit;

    if(val > x) {
    return false;
    }
    remainder = Math.trunc(remainder / 10);
    }

    return val === x;
    };

    I totally one shot submitted this ...

  • Leet Code Solution 8 - String to Integer (atoi)

    |
    Updated at

    String to Integer (atoi), Medium

    Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer.


    The algorithm for myAtoi(string s) is as follows:


    Whitespace: Ignore any leading whitespace (" ").

    Signedness: Determine the sign by checking if the next character is '-' or '+', assuming positivity if neither present.

    Conversion: Read the integer by skipping leading zeros until a non-digit character is encountered or the end of the string is reached. If no digits were read, then the resu...

  • WASM Will Take Over Containers

    |
    Updated at

    I've been looking into WebAssembly lately and I say it is the future of containerization. I mean, I've always been a fan of Docker and Podman, but WASM? It's a whole new ballgame. Imagine compiling your favorite language (Rust, Go, C/C++—you name it) into a tiny binary that boots up in milliseconds, all without the baggage of a full-blown OS. That’s what WASM brings to you. No more BS.

    WASM is the New Kid on the Block

    Here's the deal: WASM was originally created to supercharge web apps, but it’s now breakin...

  • Unexpected Rise of WebAssembly: Redefining Containerization Beyond Docker

    |
    Updated at

    The Rise of WebAssembly: Redefining Containerization Beyond Docker

    The way software is developed, deployed, and managed has been significantly transformed by containerization. Technologies like Docker and Podman have become foundational to modern cloud-native practices, enabling application isolation, portability, and scalability. However, the world of computing is always evolving and a new contender emerges with the potential to redefine containerization as we know it: WebAssembly (WASM).

    Let's explore the...

  • An America Reborn

    |
    Updated at

    My comrades, the time of endless defeat has come to an end. I stand before you burdened not merely by our losses—but by a shared, unyielding resolve. We have endured the bitter fruits of a corrupt system, one where every banner—be it Trump, Biden, or Obama—is stained by the greed and self-interest of our so‐called leaders. Their empty promises have long been the instruments of our subjugation.

    We, the people, have watched as the very foundations of our society—education, healthcare, housing, childcare—have ...

  • Beyond Reactionary Politics: It is Urgent for Democrats to Adapt and Realign for State-Level Success

    |
    Updated at

    Part 1 Democrats don't know who they're fighting against

    Part 2 How Democrats Can WIN, Really WIN.

    Democrats want to win, but they face defections into the Republican Party. I don't think Democrats understand that they are on the unpopular side of things and they have only won elections in the 21st Century by the means of being the only major opposition party. They win only by reactionary votes, which will keep dwindling as time goes on.

    Let's look at party switching to see what's going on there.

    Switches by De...

  • How Democrats Can Win, I'm Talking about WIN

    |
    Updated at

    Part 1 Democrats don't know who they're fighting against

    Part 3 Beyond Reactionary Politics: It is Urgent for Democrats to Adapt and Realign for State-Level Success


    I wanted to expand on how Democrats could win not just 2026, but the New World Order. The old one is dead or least least mortally wounded.

    Stopping National Conservatism at the state level is the single most important goal to winning. This must be at the heart of every state Democratic Party. It cannot be emphasized.

    The way to stop NatCon at the st...

  • Natural Ordering Doesn't Work With ULID, so I Combined Two Existing Sorts

    |
    Updated at

    I made an assumption on how natural ordering works and that was for the first time I've seen screwing up the ordering of records in a RocksDB database.

    It's funny I used Gemini 2.0 to evaluate how natural ordering of two ULIDs. ULID is lexicographic sort friendly DUH. it was confident that the correct ordering is what natural sort should resolve to. Wrangled my head until finally starting getting code out to analyze the sort step by step and that's where it dawned on me. 4442 is going to be greater than 7CYS...