Author: admin

  • Python 101: Python data structures such as `list`, `dict`, `set`, and others

    Python data structures such as list, dict, set, and others. 1. List (列表) 哈希表中的数组类比 (Array Analogy): A list in Python is similar to the array component in the hash table structure. Like an array, Python’s list provides indexed access to elements. List Internal Structure: Python’s list is implemented as a…

  • Python 101: hash table

    A hash table is primarily built using a dynamic array as its core structure, but it may use linked lists or trees (like balanced trees) for collision resolution. Let’s break this down in detail: 1. Core Structure: Dynamic Array What: A hash table stores its key-value pairs in an internal…

  • Tools: API Testing Tools Postman, cURL, and Swagger

    Comparison of API Testing Tools: Postman, cURL, and Swagger When developing and testing RESTful APIs, selecting the right tool can significantly improve efficiency. Below is a comparison of three commonly used API testing tools: Postman, cURL, and Swagger. Tools to Help You Test APIs Comparison Criteria Postman cURL Swagger Overview…

  • Algorithms 101: two linked lists

    1. LeetCode 21: Merge Two Sorted Lists Solution and Time Complexity Analysis: # Python code class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def mergeTwoLists(l1: ListNode, l2: ListNode) -> ListNode: dummy = ListNode() current = dummy while l1 and l2: if l1.val < l2.val: # If…

  • LeetCode: 34 Find First and Last Position of Element in Sorted Array

    LeetCode 34: Find First and Last Position of Element in Sorted Array https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ Problem Given an array of integers nums sorted in non-decreasing order and a target value target, find the first and last position of the target value in the array. If the target is not found in the…

  • System Design 101: Building a Scalable and Secure API Using FastAPI

    Building a Scalable and Secure API Using FastAPI: A Step-by-Step Guide APIs (Application Programming Interfaces) form the backbone of modern web applications, enabling communication between different services, mobile apps, and web platforms. Designing an API that is scalable, secure, and easy to maintain is critical for any application to succeed.…

  • Algorithms 101: Solving nSum Problems Efficiently

    Solving nSum Problems Efficiently: A Universal Approach in Python When it comes to LeetCode problems like 2Sum, 3Sum, and 4Sum, many programmers struggle to find a solution that is both efficient and flexible enough to handle different variants of the same problem. While solving each one individually is possible, a…

  • System Design 101: Trade-offs and Challenges in Distributed System Design

    Trade-offs and Challenges in Distributed System Design Core Challenges of Distributed Systems Ensuring data consistency, availability, and partition tolerance is one of the core challenges in distributed systems. These three properties often constrain each other, making it difficult to maximize them all within a single system. The well-known CAP Theorem…

  • Algorithms 101: `heapq` Functions

    How to Quickly Remember heapq Functions 1. Introduction The heapq module in Python provides a set of functions to perform operations on a heap (priority queue). Remembering these functions can be tricky at first, but with a few simple mnemonics and visualization techniques, you can quickly recall their purposes and…

  • C# 101: Differences Between C# `Dictionary` and `HashSet`

    Differences Between C# Dictionary and HashSet Answer Explanation: Dictionary and HashSet are both collection types in C# that use a hash table for storing data, providing high lookup performance (average O(1) time complexity). While they share some similarities, they are fundamentally different in terms of structure and usage scenarios. Detailed…