摘要: 本博客不定期更新 LeetCode 题目总结,所有题目使用 Java 实现,小部分题目也提供 JavaScript 代码。我不追求一行 AC 但是我追求一题多解,比较常规的思路,解释清楚复杂度,代码可读性强。欢迎留言和评论,共同进步。这本是我自己用来复习的笔记,如果也能帮到你,那也是我的福报。 如果 阅读全文
posted @ 2020-03-18 09:02 CNoodle 阅读(2543) 评论(2) 推荐(1) 编辑
摘要: A sentence is a string of single-space separated words where each word consists only of lowercase letters. A word is uncommon if it appears exactly on 阅读全文
posted @ 2024-09-18 02:57 CNoodle 阅读(3) 评论(0) 推荐(0) 编辑
摘要: You are given an integer array nums of size n. Consider a non-empty subarray from nums that has the maximum possible bitwise AND. In other words, let 阅读全文
posted @ 2024-09-15 03:28 CNoodle 阅读(7) 评论(0) 推荐(0) 编辑
摘要: You are given two integers m and n, which represent the dimensions of a matrix. You are also given the head of a linked list of integers. Generate an 阅读全文
posted @ 2024-09-15 00:41 CNoodle 阅读(1) 评论(0) 推荐(0) 编辑
摘要: You start at the cell (rStart, cStart) of an rows x cols grid facing east. The northwest corner is at the first row and column in the grid, and the so 阅读全文
posted @ 2024-09-14 14:58 CNoodle 阅读(0) 评论(0) 推荐(0) 编辑
摘要: You are given the head of a linked list, which contains a series of integers separated by 0's. The beginning and end of the linked list will have Node 阅读全文
posted @ 2024-09-09 10:36 CNoodle 阅读(3) 评论(0) 推荐(0) 编辑
摘要: You are given a 2D matrix grid of size m x n. You need to check if each cell grid[i][j] is: Equal to the cell below it, i.e. grid[i][j] == grid[i + 1] 阅读全文
posted @ 2024-08-29 05:27 CNoodle 阅读(10) 评论(0) 推荐(0) 编辑
摘要: A distinct string is a string that is present only once in an array. Given an array of strings arr, and an integer k, return the kth distinct string p 阅读全文
posted @ 2024-08-05 14:25 CNoodle 阅读(25) 评论(0) 推荐(0) 编辑
摘要: A swap is defined as taking two distinct positions in an array and swapping the values in them. A circular array is defined as an array where we consi 阅读全文
posted @ 2024-08-04 02:56 CNoodle 阅读(15) 评论(0) 推荐(0) 编辑
摘要: Given an m x n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element of the matrix such that i 阅读全文
posted @ 2024-07-19 13:14 CNoodle 阅读(28) 评论(0) 推荐(0) 编辑
摘要: You are given a binary array possible of length n. Alice and Bob are playing a game that consists of n levels. Some of the levels in the game are impo 阅读全文
posted @ 2024-07-19 06:16 CNoodle 阅读(12) 评论(0) 推荐(0) 编辑
摘要: You are given a 2D integer array descriptions where descriptions[i] = [parenti, childi, isLefti] indicates that parenti is the parent of childi in a b 阅读全文
posted @ 2024-07-17 00:41 CNoodle 阅读(4) 评论(0) 推荐(0) 编辑
摘要: There are n balls on a table, each ball has a color black or white. You are given a 0-indexed binary string s of length n, where 1 and 0 represent bla 阅读全文
posted @ 2024-06-06 01:41 CNoodle 阅读(12) 评论(0) 推荐(0) 编辑
摘要: You have observations of n + m 6-sided dice rolls with each face numbered from 1 to 6. n of the observations went missing, and you only have the obser 阅读全文
posted @ 2024-05-27 04:23 CNoodle 阅读(29) 评论(0) 推荐(0) 编辑
摘要: You are given a 0-indexed integer array nums having length n, an integer indexDifference, and an integer valueDifference. Your task is to find two ind 阅读全文
posted @ 2024-05-26 13:09 CNoodle 阅读(1) 评论(0) 推荐(0) 编辑
摘要: You are given a 0-indexed integer array nums and an integer k. A subarray is called equal if all of its elements are equal. Note that the empty subarr 阅读全文
posted @ 2024-05-23 05:27 CNoodle 阅读(11) 评论(0) 推荐(0) 编辑
摘要: The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty. For example, the XOR total of the array [2,5, 阅读全文
posted @ 2024-05-20 13:38 CNoodle 阅读(68) 评论(0) 推荐(0) 编辑
摘要: There are n projects numbered from 0 to n - 1. You are given an integer array milestones where each milestones[i] denotes the number of milestones the 阅读全文
posted @ 2024-05-16 07:11 CNoodle 阅读(15) 评论(0) 推荐(0) 编辑
摘要: You are given an array happiness of length n, and a positive integer k. There are n children standing in a queue, where the ith child has happiness va 阅读全文
posted @ 2024-05-10 05:13 CNoodle 阅读(9) 评论(0) 推荐(0) 编辑
摘要: You are given a 0-indexed integer array batteryPercentages having length n, denoting the battery percentages of n 0-indexed devices. Your task is to t 阅读全文
posted @ 2024-05-10 03:38 CNoodle 阅读(4) 评论(0) 推荐(0) 编辑
摘要: Alice and Bob want to water n plants in their garden. The plants are arranged in a row and are labeled from 0 to n - 1 from left to right where the it 阅读全文
posted @ 2024-05-10 01:44 CNoodle 阅读(5) 评论(0) 推荐(0) 编辑