Docker Basics

What is Docker? Docker, like git in version control, is the most popular implementation in containerization. Why do we need containers? Because we want consistency in building, running, and shipping applications. In an app, we usually have the code we wrote, third-party dependencies, configuration info, and things about OS(filesystem, networking, etc). With the help of containerization, no matter on which machine, our applications will run in the same environment. Virtual

Implementing Stack and Queue in JavaScript

In JavaScript, both stack and queue data structures are commonly implemented using arrays. Here’s a brief conclusion on how to implement these structures, excluding priority queues which are slightly more complex and typically use third-party libraries. Stack Stacks follow the LIFO principle. Using JavaScript arrays, we can mimic this behavior easily. create a stack 1 const stack = []; push to the top of stack

Leetcode 198.House Robber

Here are two approaches to solving the classic “House Robber” problem: Recursion + Backtracking, and Iteration. Both methods apply dynamic programming effectively, albeit in different ways. Solution One (Recursion + Backtracking) This solution I found online (author: labuladong) uses recursion and backtracking. I am not sure if this counts as dynamic programming. Basic Idea Standing in front of the i-th house, the robber has two options: rob it and jump

Top K Frequent Elements and Heapq in Python

Heapq in Python This module provides an implementation of the heap queue algorithm, also known as the priority queue algorithm. Heaps are binary trees for which every parent node has a value less than or equal to any of its children. This implementation uses arrays for which heap[k] <= heap[2*k+1] and heap[k] <= heap[2*k+2] for all k, counting elements from zero. For the sake of comparison, non-existing elements are considered

Fundamentals of Git

Explore some essential aspects of the version control tool Git. Concept Initially, as a newcomer, I confused Git with GitHub (a platform), not realizing Git is fundamentally a local tool. Some refer to it as a version control tool, a file system, or even a database with key-value pairs. To harness its capabilities, it’s crucial to understand the primary command: 1 git init This command creates a .git folder in