leetcode validate binary nodes

[LeetCode][70]climbing-stairs

# Content You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can ......
climbing-stairs LeetCode climbing stairs 70

[LeetCode][32]longest-valid-parentheses

# Content Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring. Examp ......

[LeetCode][53]maximum-subarray

# Content Given an integer array nums, find the subarray with the largest sum, and return its sum. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Ou ......

[LeetCode][55]jump-game

# Content You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your ......
jump-game LeetCode jump game 55

[LeetCode][62]unique-paths

# Content There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the ......
unique-paths LeetCode unique paths 62

[LeetCode][42]trapping-rain-water

# Content Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raini ......

[LeetCode][10]regular-expression-matching

# Content Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where: '.' Matches any single ch ......

[LeetCode][64]minimum-path-sum

# Content Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along ......
minimum-path-sum LeetCode minimum path sum

Node.js 获取项目根目录的几种方法

`module.filename`:开发期间,该行代码所在的文件。 `__filename`:表示当前正在执行的脚本的文件名。它将输出文件所在位置的绝对路径,且和命令行参数所指定的文件名不一定相同。 如果在模块中,返回的值是模块文件的路径。 始终等于 module.filename。 `__dirn ......
根目录 方法 项目 Node js

LeetCode[10]RegularExpressionMatching

# Content Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where: '.' Matches any single ch ......
RegularExpressionMatching LeetCode 10

LeetCode[32]LongestValidParentheses

# Content Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring. Examp ......
LongestValidParentheses LeetCode 32

LeetCode[42]TrappingRainWater

# Content Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raini ......
TrappingRainWater LeetCode 42

LeetCode[53]MaximumSubarray

# Content Given an integer array nums, find the subarray with the largest sum, and return its sum. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Ou ......
MaximumSubarray LeetCode 53

LeetCode[62]UniquePaths

# Content There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the ......
UniquePaths LeetCode 62

LeetCode[55]JumpGame

# Content You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your ......
LeetCode JumpGame 55

LeetCode[64]MinimumPathSum

# Content Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along ......
MinimumPathSum LeetCode 64

Node.js面试题

Node.js面试题 1、你了解 Node. js吗? Node. js是一个基于 Chrome v8引擎的服务器端 JavaScript运行环境;Node. js是一个事件驱动、非阻塞式I/O的模型,轻量而又高效;Node. js的包管理器npm是全球最大的开源库生态系统。 2、Node. js的 ......
Node js

【LeetCode1270. 向公司CEO汇报工作的所有人】with recursive找到某节点所有的后代

# 题目地址 https://leetcode.cn/problems/all-people-report-to-the-given-manager/description/ # 代码 ``` WITH RECURSIVE cte_subordinates AS ( -- 基础情况: 找到直接下属 ......
节点 后代 recursive LeetCode 所有人

【leetcode】1.two sum

第一题给我干懵了...想达到这个要求把我脑壳都想痛了...Follow-up: Can you come up with an algorithm that is less than O(n2) time complexity? 一开始想过用map,但是不能解决重复key的问题。 然而我用sort, ......
leetcode two sum

2023.8.17 - env运行时变量在node中运行问题

在Vue.js中,你不能直接在模板文件中访问`.env`文件中定义的环境变量。`.env`文件中的变量是在构建过程中被注入到应用程序中的,而不是在运行时可访问的。 然而,你可以使用Vue提供的`process.env`来访问在构建过程中注入的环境变量。在Vue组件的JavaScript代码中,你可以 ......
变量 问题 2023 node env

vue开发超级方便的Node版本管理器nvm

nvm全名node.js version management,是 nodejs 的版本管理工具 可以在一个环境中同时安装多个 nodejs 版本(和配套的 npm 版本),并随时切换 开发调试不同 nodejs 应用变得更省心,随时切换所需要的版本。 github地址: nvm git 地址 nv ......
版本 Node vue nvm

关于Node.js 构建中遇到node-gyp报错问题的解决方案记录

项目今天进行版本更新,在走阿里云流水线的时候,出现了Node.js 构建过程报错问题,抱歉详情截图如下: 经过反复排查,最终发现是因为阿里云的npm仓库的问题,于是果断更换npm仓库,执行命令如下: npm config set registry https://registry.npm.taoba ......
node-gyp 解决方案 方案 问题 Node

[32]Longest Valid Parentheses

# Content Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring. Examp ......
Parentheses Longest Valid 32

ERR! gyp info using node-gyp@3.8.0

解决方案就是在电脑里的Windows PowerShell用管理身份运行以下的语句就能顺利运行npm install npm install --global --production windows-build-tools ......
gyp node-gyp using info node

LeetCode 1581. 进店却未进行过交易的顾客

##题目 表:Visits ```sql + + + | Column Name | Type | + + + | visit_id | int | | customer_id | int | + + + visit_id 是该表中具有唯一值的列。 该表包含有关光临过购物中心的顾客的信息。 ``` ......
LeetCode 顾客 1581

Leetcode 19. 删除链表的倒数第N个结点(Remove nth node from end of list)

[题目链接](https://leetcode.cn/problems/remove-nth-node-from-end-of-list) 给你一个链表, 删除链表的倒数第n个结点, 并且返回链表的头结点. 示例 1: ``` 输入:head = [1,2,3,4,5], n = 2 输出:[1,2 ......
结点 Leetcode Remove node from

Leetcode148 排序链表

148. 排序链表 - 力扣(LeetCode) /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr ......
Leetcode 148

二叉搜索树(BST,binary search tree)

对于静态查找可以用二分查找,将查找时间复杂度降到 log2 n 。其中,虽然数据存储在线性的结构里,但我们事先对数据进行了处理,在查找的顺序过程中运用到判定树这样的结构,将线性上的查找过程转变为了在类似树上面的查找过程,其查找的效率就是树的高度。但如果查找的集合不仅有查找还有删除新增的需求,而树具有 ......
binary search tree BST

LeetCode -- 151. 反转字符串中的单词(手写一个trim函数)

本题我们采用 class Solution { public: string reverseWords(string s) { stack<string> stk; int n = s.size(), l = 0, r = n - 1; //trim函数 while(l < n && s[l] == ......
字符串 单词 函数 字符 LeetCode

什么是 Node.js 的 cross-env 工具包

`cross-env` 是一个运行在 Node.js 环境中的工具包,它的主要作用是让我们可以在命令行中设置环境变量,而不必担心跨操作系统的兼容问题。在 Unix 和 Windows 系统中设置环境变量的方式是不同的,这就导致了我们无法写出一条在所有操作系统中都可以运行的设置环境变量的命令。`cro ......
工具包 cross-env 工具 cross Node