Lagrange Interpolation Method

🖋️ Starting from known points Given the task of constructing a function f(x) f(x) f(x)that passes through the points P1(x1,y1),P2(x2,y2),⋯ ,Pn(xn,yn) P_1(x_1, y_1), P_2(x_2, y_2), \cdots, P_n(x_n, y_n) P1​(x1​,y1​),P2​(x2​,y2​),⋯,Pn​(xn​,yn​), first let the projection of the i th point onto the x axis be ...

2026-09-10

Leetcode reflection (1)

1732. Find the Highest Altitude There is a biker going on a road trip. The road trip consists of n + 1 points at different altitudes. The biker starts his trip on point 0 with altitude equal 0. You are given an integer array gain of length n where gain[i] is the net gain in altitude between points i and i + 1 for all (0 <= i < n). Return the highest altitude of a point. ...

2026-09-10

Rust Notes 3

🔔 Prelude: In the end, all data types in Rust come from these primitive types. Basic types Every value in Rust has a specific data type In general, these can be divided into two categories: scalar types and compound types Scalar types include: Numbers: Signed integers (i8, i16, i32, i64, isize), unsigned integers (u8, u16, u32, u64, usize), floating-point numbers (f32, f64) The isize and usize types depend on the architecture of the computer the program is running on: if the CPU is 32-bit, these types are 32-bit; similarly, if the CPU is 64-bit, they are Rust’s default integer type is i32 Can overflow, and Rust does not check for this by default. If you encounter incorrect values, make sure to check the type of your numbers. Strings: String literals and string slices Booleans: true and false Characters: Representing a single Unicode character, stored as 4 bytes Unit type: Represented by (), with its only value also being () Be Careful with floats See this example: ...

2026-09-10

Rust Notes 2

Syntax of Rust Don’t worry, this will be very easy at the beginning. (Really?) Function goes first Similar to C and C++, there must be a main function as the entry point of the program. Use fn to declare a function, so concise. Use () for receiving parameters, and {} for the actual logic inside the function. Remember to use ; to end a statement. As I said, it’s similar to C and C++. Example: fn main() -> { println!("Hello, world!"); // "ln" means print with a new line after the content // What is "!"? Well, it means this function is actually a macro // For now, let's just use it as is // You don't need to learn everything to start using Rust. Heart. } A complete structure of function head in Rust should be: ...

2026-09-10

Rust Notes 1

About these notes These Rust notes are just a collection of my learning records. Since I’m a beginner in Rust, these notes are more like quick references or supplements, rather than a comprehensive Rust tutorial. No matter what, I hope you can still find parts that are useful to you. Why rust? Rust’s advantages include memory safety, high performance, and high productivity. To me, Rust appears to be one of the best implementations of C++. If you don’t get into deeper topics and only use prepared libraries, Rust’s syntax is simple and clear. Its built-in compiler cautions are also quite informative, which significantly decreases the amount of thinking required on developers. ...

2026-09-10

Window Functions in SQL

🔔 Prelude: Boss: “I need the average sales for 7 days.” Me: “Sure! Which 7 days?” Boss: “All the 7 days!” Me: “Su…Sure…?” 🖋️ Window Functions Window functions are generally applied after aggregate functions like MAX(), MIN(), AVG() to perform calculations across a set of table rows(days before, days after) that are related to the current row(current day). Example Table 1: employees employee_id department_id salary 1 101 5000 2 101 6000 3 101 5500 4 102 7000 5 102 7200 6 102 6800 Example 1: OVER() Without Partitioning Calculate the average salary for all employees: ...

2026-09-10

Move Zeroes: Understanding Parameter Behavior in Python

🔔 Prelude: When addressing the “Move Zeroes” problem, it is simple to misinterpret Python’s parameter behavior. Remember: A local variable and a parameter sharing the same name does not mean they refer to the same object. 🖋️ Move Zeroes Given an integer array nums, move all 0’s to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the array. ...

2026-09-10

CO-STAR Template for ChatGPT

🔔 Prelude: If you use ChatGPT frequently, you’ve probably encountered situations where it provides off-topic answers. Since we can’t modify the model, the better approach is to rely on accurate prompts and additional context. 🖋️ Main Let ChatGPT Answer Your Questions Accurately! First, you need to let ChatGPT know some personal information about you and how it should respond to you. Click on your profile picture at the top right corner. Select “Customize ChatGPT.” Hover over the “Custom Instructions” question mark on the right and fill in the information as guided. Use the specific CO-STAR template in a new session. Interact with ChatGPT. CO-STAR Template The CO-STAR template is a structured method that can help you communicate more clearly and effectively with ChatGPT. By providing context, objectives, style, tone, audience, and response format, you can explain exactly what you need from ChatGPT, and get replies that correspond more closely with your requirements. ...

2026-09-10

Tips for Better Google Searches

💡 Prelude: I collected some common advanced keywords for Google searching. These tips are generally applicable to most search engines. You can also “search” on this page to find what you need. Exact Keywords Use "key words ..." (double quotes) to prevent keywords from being split up during the search. Exclude Keywords Use - to exclude keywords. For example:python usage -w3s Wildcard The * in the search bar works similarly to the wildcard in Linux. ...

2026-09-10

Choose your licenses

🔔 Prelude: I sometimes wonder if adding a license to my campus homework is too serious. Nevertheless, I still will add it. 🖋️ Main License Version Include License Include Source Code Trademark Status Change Commercial Use Distribution Modification Patent Right Private Use License Transfer No Liability No Trademark Apache License 2.0 Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes FreeBSD License Yes Yes Yes Yes Yes Yes Yes 2-Clause BSD License Yes Yes Yes Yes Yes Yes Yes GNU General Public License(GPL) 2.0 Yes Yes Yes Yes Yes Yes Yes No Yes GNU Lesser General Public License 2.1 Yes Yes Yes Yes Yes Yes Yes No Yes GNU General Public License 3.0 Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes GNU Lesser General Public License 3.0 Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes MIT License Yes Yes Yes Yes Yes Yes Yes Yes Mozilla Public License(MPL) 2.0 Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Eclipse Public License 1.0 Yes Yes Yes Yes Yes Yes Yes Yes No Yes Affero General Public License 3.0 Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes General Copyright Yes Yes Yes Yes No No Yes No In short? Completely Open Source -> MIT License, BSD License Open Source, But Must Credit the Original Author -> Apache License 2.0 Open Source, Must Use the Same License (Copyleft) -> GPL Allows Commercial Use -> MIT License, BSD License, Apache License 2.0, GPL Allows Closed Source (Can Be Integrated into Proprietary Software) -> MIT License, BSD License, Apache License 2.0 Does Not Allow Closed Source (Must Remain Open Source) -> GPL

2026-09-10