Author: admin

  • Python 101: Understanding the `self` Keyword in Python: A Different Perspective

    Introduction The self keyword in Python is a cornerstone of object-oriented programming, used to refer to the instance of the class itself. By mastering self, you can create classes that encapsulate data and behaviors in a more organized and efficient manner. Let’s explore self with different examples, tips, comparisons, and…

  • Algorithms 101: Using Bitwise AND to Check the Least Significant Bit

    The bitwise AND operation is a fundamental tool in low-level programming, and it’s particularly useful when working with binary data. One common use case is to check whether a number is even or odd by examining its least significant bit (LSB). This technique is efficient and commonly used in performance-critical…

  • LeetCode: 371 Sum of Two Integers

    Given two integers a and b, return the sum of the two integers without using the operators + and -. Example: Input: a = 1, b = 2 Output: 3 Example: Input: a = 2, b = 3 Output: 5 问题 给定两个整数 a 和 b,在不使用 + 和 – 运算符的情况下,返回两个整数的和。 解决方案…

  • LeetCode: 268 Missing Number

    Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array. Example: Input: nums = [3,0,1] Output: 2 Explanation: n = 3 since there are 3 numbers, so all numbers are in the range [0,3].…

  • LeetCode: 191 Number of 1 Bits

    Here’s a detailed explanation and solution for LeetCode 191: Number of 1 Bits, with explanations provided in both English and Chinese, line by line. Problem Write a function that takes an unsigned integer and returns the number of ‘1’ bits it has (also known as the Hamming weight). Example: Input:…

  • Artificial Intelligence 101: Embeddings in Natural Language Processing

    AI中的嵌入技术 In the field of natural language processing (NLP), embeddings are a crucial technique used to convert textual data into dense, continuous vectors that capture semantic information about words, phrases, or even entire sentences. These embeddings are used as input to machine learning models, enabling them to understand and process…

  • Artificial Intelligence 101: RNN and NLP

    RNN和自然语言处理 Recurrent Neural Networks (RNNs) have been a foundational architecture in the field of natural language processing (NLP) for many years. They are particularly well-suited for tasks that involve sequential data, where the order of elements (such as words in a sentence) is critical. RNNs can maintain a hidden state…

  • Artificial Intelligence 101: Tokenizer and One-Hot

    AI中的分词器与One-Hot编码 In natural language processing (NLP) and machine learning, preparing textual data for model training involves converting text into numerical representations that can be processed by algorithms. Two fundamental techniques used for this are tokenization and one-hot encoding. Understanding how these methods work and when to use them is essential…

  • LeetCode: 572 Subtree of Another Tree

    Given the roots of two binary trees root and subRoot, write a function to determine if subRoot is a subtree of root. A subtree of a binary tree T is a tree that consists of a node in T and all of this node’s descendants. The tree T could also…

  • Artificial Intelligence 101: Practical Example of Fine-Tuning to Reduce Legal Document Generation Hallucination

    实际案例:通过微调减少法律文件生成中的幻觉 Legal document generation is a critical task that requires a high level of accuracy and reliability, especially when dealing with legal precedents, statutes, and contracts. AI models that generate legal documents must avoid hallucinations—instances where the model creates incorrect or fabricated information, such as inventing legal precedents or misquoting…