
LeetCode
文章平均质量分 91
Navigator_Z
烈焰,在冰冷的海水中跳跃; 闪电,在自己的影子中熄灭。
展开
-
LeetCode //C - 747. Largest Number At Least Twice of Others
Summary:The problem requires determining if the largest element in an array is at least twice as large as every other element. The solution involves two steps: first, finding the maximum element and its index, and then verifying its dominance by checking原创 2025-06-08 07:15:00 · 415 阅读 · 0 评论 -
LeetCode //C - 745. Prefix and Suffix Search
This summary describes how to design a special dictionary that supports prefix and suffix search.Key points:Trie structure using composite keys: store all possible suffix#prefix combinations for each word in the trieIndex tracking: each trie node store原创 2025-06-07 07:15:00 · 505 阅读 · 0 评论 -
LeetCode //C - 743. Network Delay Time
Abstract: This problem requires calculating the shortest time to send a signal from a given node k to all other nodes in the network. Use Dijkstra's algorithm to solve the single-source shortest path: First, construct an adjacency list to represent the gra原创 2025-06-06 07:15:00 · 710 阅读 · 0 评论 -
LeetCode //C - 741. Cherry Pickup
Abstract:This problem requires collecting the most cherries from the starting point (0,0) to the end point (n-1,n-1) in an n×n grid. The rules are: movement can only be to the right or down (outbound) and left or up (return), cannot pass through thorns (-原创 2025-06-05 07:15:00 · 883 阅读 · 0 评论 -
LeetCode //C - 740. Delete and Earn
Summary:Problem: Given an array, maximize points by deleting numbers while also deleting adjacent numbers (nums[i]-1 and nums[i]+1).Approach:Sort and group numbers to count frequencies.Use dynamic programming to decide whether to take a number (earn i原创 2025-06-04 07:15:00 · 1013 阅读 · 0 评论 -
LeetCode //C - 738. Monotone Increasing Digits
An integer has monotone increasing digits if and only if each pair of adjacent digits x and y satisfy x <= y.Given an integer n, return *the largest number that is less than or equal to n with monotone increasing digits.*原创 2025-06-03 07:15:00 · 1242 阅读 · 0 评论 -
LeetCode //C - 736. Parse Lisp Expression
The abstract of this article can be summarized as follows:Lisp expression parsing algorithmThis paper proposes a recursive solution for parsing Lisp-like expressions. The algorithm handles nested expressions through recursive descent parsing and uses a s原创 2025-06-02 07:15:00 · 971 阅读 · 0 评论 -
LeetCode //C - 733. Flood Fill
This problem implements the flood fill algorithm using depth-first search (DFS). Starting from a given pixel (sr,sc), we recursively traverse horizontally and vertically adjacent pixels with the same original color, changing them to the target color. The s原创 2025-06-01 06:15:00 · 934 阅读 · 0 评论 -
LeetCode //C - 732. My Calendar III
This article introduces the C language solution for LeetCode 732 "My Calendar III". This problem requires that after each new event [startTime, endTime) is added, the maximum number of overlaps k of all current events is returned.Key ideas:Use a differe原创 2025-05-31 07:15:00 · 842 阅读 · 0 评论 -
LeetCode //C - 731. My Calendar II
Article Abstract:This article describes how to implement a calendar system that ensures that no triple bookings (i.e., three events overlapping in a certain time period) are generated when new events are added. The solution consists of two lists: a single原创 2025-05-30 07:15:00 · 1580 阅读 · 0 评论 -
LeetCode //C - 709. To Lower Case
The problem requires converting all uppercase letters in a string to lowercase. The solution involves iterating through each character using a pointer, checking if it is an uppercase letter (A-Z), and converting it to lowercase by adding 32 (the ASCII diff原创 2025-05-29 07:15:00 · 337 阅读 · 0 评论 -
LeetCode //C - 730. Count Different Palindromic Subsequences
Problem: Count distinct palindromic subsequences in string with only 'a','b','c','d' charactersCore Idea: Use DP where dp[i][j][c] = count of palindromes in range [i,j] starting/ending with character cKey Insight: For palindromes starting/ending with sam原创 2025-05-28 07:15:00 · 828 阅读 · 0 评论 -
LeetCode //C - 729. My Calendar I
This article introduces a C language implementation for managing calendar events. The main function is to add new events and ensure that double bookings with overlapping times do not occur. The core of the implementation is to use a linked list to store al原创 2025-05-27 07:15:00 · 850 阅读 · 0 评论 -
LeetCode //C - 728. Self Dividing Numbers
Self-dividing numbers are numbers divisible by every digit they contain, excluding those with the digit zero. Given a range [left, right], the task is to identify all such numbers within this range. The solution involves iterating through each number in th原创 2025-05-26 07:15:00 · 927 阅读 · 0 评论 -
LeetCode //C - 726. Number of Atoms
This problem requires parsing a chemical formula and calculating the number of each atom. The chemical formula may contain nested parentheses and multiplicities represented by numbers. The solution is to use a stack to handle nested structures, storing the原创 2025-05-25 07:15:00 · 736 阅读 · 0 评论 -
LeetCode //C - 725. Split Linked List in Parts
The problem requires splitting a singly linked list into k consecutive parts with lengths as equal as possible. The solution involves first counting the total number of nodes in the list. Then, the base size for each part is calculated by dividing the tota原创 2025-05-24 07:15:00 · 1008 阅读 · 0 评论 -
LeetCode //C - 722. Remove Comments
The question requires removing comments from C++ source code, including line comments ("//") and block comments ("/* ... */"). The solution is to traverse each line of code, use the flag inBlock to determine whether it is in a block comment, and use the bu原创 2025-05-23 07:15:00 · 679 阅读 · 0 评论 -
LeetCode //C - 721. Accounts Merge
Summary:The problem involves merging accounts based on shared emails. Each account contains a name and a list of emails. If two accounts share at least one email, they belong to the same person. The goal is to merge these accounts and return them in a spe原创 2025-05-22 07:15:00 · 956 阅读 · 0 评论 -
LeetCode //C - 720. Longest Word in Dictionary
Given a string array words, representing an English dictionary, you are required to return the longest word that can be built up step by step through other words. If there are multiple words that meet the criteria, return the one with the smallest lexicogr原创 2025-05-21 07:15:00 · 507 阅读 · 0 评论 -
LeetCode //C - 719. Find K-th Smallest Pair Distance
This problem requires finding the kth smallest pair distance in an array. First, sort the array to simplify distance calculations. Then use binary search to find the target distance between the minimum distance 0 and the maximum distance (the last element原创 2025-05-20 07:15:00 · 614 阅读 · 0 评论 -
LeetCode //C - 718. Maximum Length of Repeated Subarray
The problem requires finding the maximum length of a subarray that appears in both given integer arrays, nums1 and nums2. A dynamic programming approach is used to solve this efficiently. A 2D DP table is constructed where dp[i][j] represents the length of原创 2025-05-19 07:15:00 · 383 阅读 · 0 评论 -
LeetCode //C - 717. 1-bit and 2-bit Characters
This problem requires determining whether a given binary array ends with a single character (0). By traversing the array, when encountering 1, skip the next bit, because 1 always represents two characters (10 or 11); when encountering 0, only move one bit原创 2025-05-18 07:15:00 · 1172 阅读 · 0 评论 -
LeetCode //C - 715. Range Module
Range Module is a data structure for tracking numeric ranges, supporting add, query, and delete operations for half-open intervals [left, right). The core idea of the implementation is to manage intervals through a dynamic array and merge or split interv原创 2025-05-17 07:15:00 · 1968 阅读 · 0 评论 -
LeetCode //C - 713. Subarray Product Less Than K
The question requires calculating the number of all consecutive subarrays in the array whose product is strictly less than a given integer k. If k is less than or equal to 1, return 0 directly, because no positive product will be less than 1. Use the slidi原创 2025-05-16 07:15:00 · 637 阅读 · 0 评论 -
LeetCode //C - 712. Minimum ASCII Delete Sum for Two Strings
To express something in English, ensure that the language used is clear, concise, and follows standard grammatical rules. Here are some tips to help improve English communication:Practice regularly by reading, writing, speaking, and listening to English c原创 2025-05-15 07:15:00 · 1403 阅读 · 0 评论 -
LeetCode //C - 710. Random Pick with Blacklist
【代码】LeetCode //C - 710. Random Pick with Blacklist。原创 2025-05-14 07:15:00 · 2117 阅读 · 0 评论 -
LeetCode //C - 709. To Lower Case
【代码】LeetCode //C - 709. To Lower Case。原创 2025-05-13 07:15:00 · 400 阅读 · 0 评论 -
LeetCode //C - 695. Max Area of Island
【代码】LeetCode //C - 695. Max Area of Island。原创 2025-05-12 07:15:00 · 570 阅读 · 0 评论 -
LeetCode //C - 707. Design Linked List
【代码】LeetCode //C - 707. Design Linked List。原创 2025-05-11 07:15:00 · 885 阅读 · 0 评论 -
LeetCode //C - 706. Design HashMap
【代码】LeetCode //C - 706. Design HashMap。原创 2025-05-10 07:15:00 · 1099 阅读 · 0 评论 -
LeetCode //C - 705. Design HashSet
【代码】LeetCode //C - 705. Design HashSet。原创 2025-05-09 07:15:00 · 1379 阅读 · 0 评论 -
LeetCode //C - 703. Kth Largest Element in a Stream
【代码】LeetCode //C - 703. Kth Largest Element in a Stream。原创 2025-05-08 07:15:00 · 539 阅读 · 0 评论 -
LeetCode //C - 701. Insert into a Binary Search Tree
【代码】LeetCode //C - 701. Insert into a Binary Search Tree。原创 2025-05-07 07:15:00 · 930 阅读 · 0 评论 -
LeetCode //C - 699. Falling Squares
【代码】LeetCode //C - 699. Falling Squares。原创 2025-05-06 07:15:00 · 1698 阅读 · 0 评论 -
LeetCode //C - 698. Partition to K Equal Sum Subsets
【代码】LeetCode //C - 698. Partition to K Equal Sum Subsets。原创 2025-05-05 07:15:00 · 1303 阅读 · 0 评论 -
LeetCode //C - 697. Degree of an Array
【代码】LeetCode //C - 697. Degree of an Array。原创 2025-05-04 07:15:00 · 837 阅读 · 0 评论 -
LeetCode //C - 696. Count Binary Substrings
【代码】LeetCode //C - 696. Count Binary Substrings。原创 2025-05-03 07:15:00 · 596 阅读 · 0 评论 -
LeetCode //C - 695. Max Area of Island
【代码】LeetCode //C - 695. Max Area of Island。原创 2025-05-02 07:15:00 · 988 阅读 · 0 评论 -
LeetCode //C - 693. Binary Number with Alternating Bits
【代码】LeetCode //C - 693. Binary Number with Alternating Bits。原创 2025-05-01 07:15:00 · 617 阅读 · 0 评论 -
LeetCode //C - 692. Top K Frequent Words
【代码】LeetCode //C - 692. Top K Frequent Words。原创 2025-04-30 07:15:00 · 849 阅读 · 0 评论