摘要: 本博客不定期更新 LeetCode 题目总结,所有题目使用 Java 实现,小部分题目也提供 JavaScript 代码。我不追求一行 AC 但是我追求一题多解,比较常规的思路,解释清楚复杂度,代码可读性强。欢迎留言和评论,共同进步。这本是我自己用来复习的笔记,如果也能帮到你,那也是我的福报。 如果 阅读全文
posted @ 2020-03-18 09:02 CNoodle 阅读(2588) 评论(2) 推荐(1) 编辑
摘要: You are given a string s consisting of the characters 'a', 'b', and 'c' and a non-negative integer k. Each minute, you may take either the leftmost ch 阅读全文
posted @ 2024-11-21 02:31 CNoodle 阅读(5) 评论(0) 推荐(0) 编辑
摘要: You have a bomb to defuse, and your time is running out! Your informer will provide you with a circular array code of length of n and a key k. To decr 阅读全文
posted @ 2024-11-19 04:36 CNoodle 阅读(3) 评论(0) 推荐(0) 编辑
摘要: An image smoother is a filter of the size 3 x 3 that can be applied to each cell of an image by rounding down the average of the cell and the eight su 阅读全文
posted @ 2024-11-18 05:58 CNoodle 阅读(6) 评论(0) 推荐(0) 编辑
摘要: You are given two integer arrays persons and times. In an election, the ith vote was cast for persons[i] at time times[i]. For each query at a time t, 阅读全文
posted @ 2024-11-16 03:37 CNoodle 阅读(3) 评论(0) 推荐(0) 编辑
摘要: Design a data structure to find the frequency of a given value in a given subarray. The frequency of a value in a subarray is the number of occurrence 阅读全文
posted @ 2024-11-15 06:37 CNoodle 阅读(2) 评论(0) 推荐(0) 编辑
摘要: You are given an m x n binary matrix grid. A row or column is considered palindromic if its values read the same forward and backward. You can flip an 阅读全文
posted @ 2024-11-15 02:42 CNoodle 阅读(3) 评论(0) 推荐(0) 编辑
摘要: You are given an integer n indicating there are n specialty retail stores. There are m product types of varying amounts, which are given as a 0-indexe 阅读全文
posted @ 2024-11-14 13:48 CNoodle 阅读(18) 评论(0) 推荐(0) 编辑
摘要: Given two integer arrays arr1 and arr2, and the integer d, return the distance value between the two arrays. The distance value is defined as the numb 阅读全文
posted @ 2024-11-14 09:31 CNoodle 阅读(3) 评论(0) 推荐(0) 编辑
摘要: You are given a 2D integer array items where items[i] = [pricei, beautyi] denotes the price and beauty of an item respectively. You are also given a 0 阅读全文
posted @ 2024-11-14 00:21 CNoodle 阅读(3) 评论(0) 推荐(0) 编辑
摘要: Given a string s, return the maximum length of a substring such that it contains at most two occurrences of each character. Example 1: Input: s = "bcb 阅读全文
posted @ 2024-11-10 12:08 CNoodle 阅读(4) 评论(0) 推荐(0) 编辑
摘要: You are given an integer array nums and two positive integers m and k. Return the maximum sum out of all almost unique subarrays of length k of nums. 阅读全文
posted @ 2024-11-10 04:56 CNoodle 阅读(2) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers arr and two integers k and threshold, return the number of sub-arrays of size k and average greater than or equal to thresh 阅读全文
posted @ 2024-11-10 02:47 CNoodle 阅读(3) 评论(0) 推荐(0) 编辑
摘要: The bitwise AND of an array nums is the bitwise AND of all integers in nums. For example, for nums = [1, 5, 3], the bitwise AND is equal to 1 & 5 & 3 阅读全文
posted @ 2024-11-08 01:44 CNoodle 阅读(7) 评论(0) 推荐(0) 编辑
摘要: In one operation, you can swap any two adjacent elements if they have the same number of set bits. You are allowed to do this operation any number of 阅读全文
posted @ 2024-11-07 04:50 CNoodle 阅读(4) 评论(0) 推荐(0) 编辑
摘要: Given a string word, compress it using the following algorithm: Begin with an empty string comp. While word is not empty, use the following operation: 阅读全文
posted @ 2024-11-05 05:44 CNoodle 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 自己曾经做了一个网站部署在一台 ubuntu 服务器上,但是由于一开始不会配置 SSL,所以花钱买了付费的 SSL。最近发现了 Let's Encrypt,可以免费申请 SSL 证书,下面是详细的教程。 我的网站是一个 React 的项目,所以我的服务器上只是一个简单的 Node.js 环境 + N 阅读全文
posted @ 2024-11-03 01:28 CNoodle 阅读(7) 评论(0) 推荐(0) 编辑
摘要: You are given two positive integers n and k. You can choose any bit in the binary representation of n that is equal to 1 and change it to 0. Return th 阅读全文
posted @ 2024-11-02 04:17 CNoodle 阅读(9) 评论(0) 推荐(0) 编辑
摘要: Given a string s containing only digits, return the lexicographically smallest string that can be obtained after swapping adjacent digits in s with th 阅读全文
posted @ 2024-10-30 10:04 CNoodle 阅读(6) 评论(0) 推荐(0) 编辑
摘要: For a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subtrees. A binary tree X is flip e 阅读全文
posted @ 2024-10-24 12:41 CNoodle 阅读(4) 评论(0) 推荐(0) 编辑
摘要: Given an integer array hours representing times in hours, return an integer denoting the number of pairs i, j where i < j and hours[i] + hours[j] form 阅读全文
posted @ 2024-10-22 04:55 CNoodle 阅读(6) 评论(0) 推荐(0) 编辑