leetcode validate binary nodes
Node.js Buffer All In One
Node.js Buffer All In One Buffer.from https://nodejs.org/api/buffer.html#buffer ArrayBuffer https://developer.mozilla.org/en-US/docs/Web/JavaScript/Re ......
1351. 统计有序矩阵中的负数(leetcode)
https://leetcode.cn/problems/count-negative-numbers-in-a-sorted-matrix/ 1351. 统计有序矩阵中的负数 1.二分法:把每一行进行一遍二分,找到正数与负数的边界,且此时grid[i][mid]也为负数,即边界下标的对应值是负数的 ......
使用eclipsefdn/hugo-node容器构建hugo静态站点
eclipsefdn/hugo-node容器是一个基于Node.js和Hugo的Docker容器,用于构建和部署静态网站。它包含了Hugo和Node.js的环境,可以方便地进行网站的开发、构建和部署。 使用eclipsefdn/hugo-node容器可以简化网站开发和部署的流程,具体步骤如下: 安装 ......
【Node】coderwhy node 项目视频中 jwt.sign 没有返回值的问题
在写登录接口时,想生成token用于登录验证,但是在使用jwt生成token(jwt.sign())时却没有返回token,服务端没有报错但是使用postman验证接口时却没有得到正确的请求结果。 如果你在使用 openssl 生成的 private.key 时是和 coerwhy 老师一样 102 ......
npm、node本地启动服务访问静态html
1.使用express启动服务 安装express npm i express --save 新建app.js启动命令文件 var express = require('express'); var path = require('path'); var app = express(); app.u ......
k8s跨node,pod网络不通
1.前因: 客户提供的虚机:麒麟 Linux lanxin2 4.19.90-24.4.v2101.ky10.aarch64 # K8S 部署的flannel 使用vxlan 2.问题: 部分机器pod跨node,网络不通 3.分析过程: 1.查看flannel、cni网络启动正常 2.查看rout ......
【哈希表】LeetCode 767. 重构字符串
题目链接 767. 重构字符串 思路 先用哈希表统计出出现次数最多的字符,如果这个次数大于一半,说明这个字符总会挨在一起,直接返回 ""。 如果不超过一半,则先把字符填在偶数位置(先填出现次数最多的字符),偶数位置填满了再填奇数位置。 代码 class Solution { public Strin ......
[Node.js] Logging with winston package
logger.ts // .env LOGGER_LEVEL=debug // logger.ts import * as winston from "winston"; export const logger = winston.createLogger({ level: process.env. ......
[Node.js] Hanlde process.env with dotenv
import * as dotenv from "dotenv"; const result = dotenv.config(); if (result.error) { console.log('Error loading environment variables, aborting.') pr ......
node版本控制nvm
node版本控制nvm 学习资料 https://blog.csdn.net/m0_67393828/article/details/126113823 问题 nvm切换node版本,发现npm无法使用 https://blog.csdn.net/weixin_45183187/article/de ......
【DP】LeetCode 740. 删除并获得点数
题目链接 740. 删除并获得点数 思路 分析动态规划题目的时候只需要考虑最后一个阶段,因为所有的阶段转化都是相同的,考虑最后一个阶段容易发现规律 在数组的动态规划问题中,一般 dp[i] 都是表示以 nums 以前 i 个元素组成(即 nums[i - 1])的状态;dp[i][j] 分别表示以 ......
LeetCode 152. 乘积最大子数组
原题解 ###题目 约束 ###题解 class Solution { public: int maxProduct(vector<int>& nums) { int maxF = nums[0], minF = nums[0], ans = nums[0]; for (int i = 1; i < ......
SpringBoot2 hikari关于 Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl处理
##项目启动不报错,如果静默15分钟没有数据库操作就报上述错误WARN 不影响程序运行 Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@16244d67 (No operations allowed after conne ......
node同步查询数据库(mysql)
mysql模块默认异步操作,在写一些简单脚本时会比较痛苦,可以通过sync/await和Promise封装成同步操作 async function query (connection, sql) { return new Promise((resolve, reject) => { connecti ......
This dataset does not have valid histogram required for classification method, run Calculate Statistics tool to generate histogram.
此数据集没有分类方法所需的有效直方图,请运行“计算统计信息”工具生成直方图。 参考1:https://blog.csdn.net/soderayer/article/details/125409022 参考2:https://blog.csdn.net/aGang_Gg/article/detail ......
node-sass报错?三步解决!!!
##1,报错内容 ##2.解决方案 一、本地安装的node和node-sass不匹配 //查看node版本 node -v 二、下载源在国外,更换中国镜像源 //更换淘宝镜像源 npm config set registry http://registry.npmmirror.com 三、单独安装n ......
[LeetCode] 2336. Smallest Number in Infinite Set
You have a set which contains all positive integers [1, 2, 3, 4, 5, ...]. Implement the SmallestInfiniteSet class: SmallestInfiniteSet() Initializes t ......
[LeetCode] 2418. Sort the People
You are given an array of strings names, and an array heights that consists of distinct positive integers. Both arrays are of length n. For each index ......
【LeetCode动态规划#13】买卖股票含冷冻期(状态众多,比较繁琐)、含手续费
最佳买卖股票时机含冷冻期 力扣题目链接(opens new window) 给定一个整数数组,其中第 i 个元素代表了第 i 天的股票价格 。 设计一个算法计算出最大利润。在满足以下约束条件下,你可以尽可能地完成更多的交易(多次买卖一支股票): 你不能同时参与多笔交易(你必须在再次购买前出售掉之前的 ......
LeetCode 1643. 第 K 条最小指令
康托展开 一开始无脑枚举全排列, 果断超时, 还是得看看如果降低计算量。 题目destination = [2,3], 相当于2个V, 3个H, 输出全排列去重后的对应位置字典序列内容。 忽略去重 则问题为全排列, 所有可能为: $$ (\sum destination)! = (2+3)! = 5 ......
leetcode调研version0
这是我第一次发博客,所以许多功能还不太会使用。前几次的随笔既当作记录,也当作自己的练习。 最近想要刷leetcode,纠结用哪种语言(我自己学过c/c++, python, fortran, Java),所以前期做了一些调研,在此记录一下。 c语言: 网址:https://github.com/be ......
leetcode 607 銷售員
銷售員 select s.`name` from salesperson s left join orders o on s.sales_id=o.sales_id left join company c on o.com_id=c.com_id and c.name='RED' group by ......
Nginx 502 bad request | Docker | Node.js http-server
##场景 本地开发的 Vue 项目, 测试之后准备部署; 本地使用 http-server 正常运行; 服务器环境为: Docker 运行的 Nginx 和 Node.js 容器; 目标是将项目通过 Node.js 容器运行 Node.js 容器启动命令为 sudo docker run --nam ......
leetcode 595 大的國家
大的國家 select `name`, population, area from World where area >= 3000000 or population >= 25000000 ......
【DP】LeetCode 213. 打家劫舍 II
题目链接 213. 打家劫舍 II 思路 分析动态规划题目的时候只需要考虑最后一个阶段,因为所有的阶段转化都是相同的,考虑最后一个阶段容易发现规律 在数组的动态规划问题中,一般 dp[i] 都是表示以 nums 以前 i 个元素组成(即 nums[i - 1])的状态;dp[i][j] 分别表示以 ......
leetcode 586 訂單最多的客戶
訂單最多的客戶 select customer_number from Orders group by customer_number having count(order_number) = ( select count(order_number) from Orders group by cus ......
使用nvm如何切换node版本
1.关于nvm的下载以及安装 下载 1、个人建议使用 nvm 1.1.7 指定版本,因为下面有最新的踩坑记录 nvm-noinstall.zip: 绿色免安装版本,但是使用之前需要配置 nvm-setup.zip:安装包,下载之后点击安装,无需配置就可以使用,方便,推荐 Source code(zi ......
leetcode 584 尋找用戶推薦人
尋找用戶推薦人 select name from customer where referee_id <> 2 or referee_id is null ......
leetcode 570 至少有5名直接下屬的經理
至少有5名直接下屬的經理 子查詢 select `name` from Employee where id in ( select managerId from Employee group by managerId having count(managerId) >= 5 ) 自連接 select ......