LeetcodeAdd Two Numbers - References in Python (with C++ Comparisons)

Python variables do not store raw values directly but instead hold references to objects on the heap. This note builds a practical mental model for how references work, how they compare to C++ pointers, and how this affects assignment, mutation, function parameters, copying, and common pitfalls. We include small typed examples and a focused discussion of shallow copies such as a.copy() vs m1.copy() in both flat and nested list cases.

Coding

Leetcodetwo sum

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

Coding

Leetcodetwo sum decorators

A decorator is just a callable that takes a function and returns a new one, often a wrapper, letting us extend behavior while keeping functions clean and following the Open–Closed Principle.

Coding

Leetcodetwo sum type annotation

Several examples are presented to clarify the definition and application of type annotations in Python.

Coding

无名树

院角那株不知名的树,自漫长阴雨时节便浸在阴翳里。我总在窗前半掩着帘,看它瘦削的枝桠将天色裁成淡墨的写意,恍若故纸堆里褪了色的水墨小品。

随想Reflections​
1234514