自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(7)
  • 问答 (1)
  • 收藏
  • 关注

原创 【leetcode】79 Word Search

Given an m x n grid of characters board and a string word, return true if word exists in the grid.The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cel

2022-01-10 17:02:34 161

原创 JavaScript 初始化二维数组的方法

写题时经常遇到需要初始化二维数组的情况我目前用过三种方法://初始化 n x m 的二维数组//1.const arr = Array.from({length: n}, () => new Array(m).fill(0));//2.const arr = [...Array(n)].map(() => Array(m).fill(0));//3.const arr = new Array(n).fill(0).map((v) => new Array(m).fill

2022-01-10 15:28:11 629

原创 【leetcode】 340 Longest Substring with At Most K Distinct Characters

Given a string s and an integer k, return the length of the longest substring of s that contains at most k distinct characters.Example 1:Input: s = “eceba”, k = 2Output: 3Explanation: The substring is “ece” with length 3.Example 2:Input: s = “aa”, k

2022-01-10 07:00:31 2987

原创 【leetcode】1011. Capacity To Ship Packages Within D Days

A conveyor belt has packages that must be shipped from one port to another within days days.The ith package on the conveyor belt has a weight of weights[i]. Each day, we load the ship with packages on the conveyor belt (in the order given by weights). We

2022-01-10 06:48:19 156

原创 【leetcode】67 Add Binary

Given two binary strings a and b, return their sum as a binary string.Input: a = “11”, b = “1”Output: “100”// 将string 转为 numberlet a = '1'console.log(typeof +a) // number // 若b为falsy,a为0,否则a = bconst a = b || 0var addBinary = function(a, b) {

2022-01-10 05:18:49 2547

原创 【leetcode】26 Remove Duplicates from Sorted Array

26. Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same.Since it is impossible to change the length of the a

2022-01-09 11:26:12 3224

原创 【leetcode】298 Binary Tree Longest Consecutive Sequence(二叉树最长连续序列)

298.Binary Tree Longest Consecutive SequenceGiven the root of a binary tree, return the length of the longest consecutive sequence path.The path refers to any sequence of nodes from some starting node to any node in the tree along the parent-child connec

2022-01-04 14:13:32 356

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除