魔豆(Magicbean)的博客

分享计算机专业的相关知识
私信 关注
魔豆Magicbean
码龄13年
  • 468,127
    被访问量
  • 742
    原创文章
  • 4,150
    作者排名
  • 125
    粉丝数量
  • 于 2008-04-18 加入CSDN
获得成就
  • 获得122次点赞
  • 内容获得32次评论
  • 获得159次收藏
荣誉勋章
兴趣领域
  • #人工智能
    #视觉/OpenCV#TensorFlow#PyTorch#算法#机器学习#Python#深度学习#图像处理
TA的专栏
  • 数据库与大数据
    2篇
  • 操作系统
  • 计算机网络
  • 程序设计语言
    34篇
  • 数据结构及算法
  • 计算几何
    1篇
  • 计算机图形学
  • 计算机视觉
  • 图像处理
  • 机器学习
  • 系统设计
    1篇
  • 数学模型
    1篇
  • IT公司面试习题
    736篇
  • 计算统计学
  • 最近
  • 文章
  • 资源
  • 问答
  • 课程
  • 帖子
  • 收藏
  • 关注/订阅

[TypeScript] 编程实践之1: Google的TypeScript代码风格13:语法

TypeScript语言规范A 语法A.1 类型A.2 表达式A.3 语句A.4 函数A.5 接口A.6 类A.7 枚举A.8 命名空间A.9 Script和ModulesA.10 AmbientA 语法本附录包含在主文档中找到的语法摘要。 如2.1节所述,TypeScript语法是ECMAScript 2015语言规范(特别是ECMA-262标准,第6版)中定义的语法的超集,本附录仅列出从ECMAScript语法中新增或修改的产品。A.1 类型TypeParameters: < TypeP
翻译
172阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格12:Ambients

TypeScript语言规范12 Ambients12.1 Ambients声明12.1.1 Ambient变量声明12.1.2 Ambient函数声明12.1.3 Ambient类声明12.1.4 Ambient枚举声明12.1.5 Ambient命名空间声明12.2 Ambient模块声明12 Ambients环境声明用于在现有JavaScript代码上提供静态类型。 环境声明与常规声明的不同之处在于,不会为它们生成JavaScript代码。 环境声明不是引入新的变量,函数,类,枚举或命名空间,而是
翻译
119阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格11:Script和Modules

TypeScript语言规范11 Scripts和Modules11.1 程序和源文件11.1.1 源文件依赖11.2 Script11.3 Modules11.3.1 Module命名11.3.2 导入声明11.3.3 Import Require声明11.3.4 Export声明11.3.4.1 Export修饰符11.3.4.2 Export Default声明11.3.4.3 Export list声明11.3.4.4 导出成员集11.3.5 Export赋值11.3.6 CommonJS模块11.
翻译
125阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格10:命名空间

TypeScript语言规范10 命名空间10.1 命名空间声明10.2 命名空间体10.3 导入别名声明10.4 导出声明10.5 声明合并10.6 代码生成10 命名空间命名空间提供了一种在命名容器的层次结构中组织代码和声明的机制。 命名空间具有命名的成员,每个成员表示一个值,一个类型或一个命名空间,或其某种组合,这些成员可以是本地的也可以是导出的。 命名空间的主体对应于一次执行的功能,从而提供了一种机制,用于确保局部状态并确保隔离。 命名空间可以看作是立即调用的函数表达(IIFE)模式的形式化形式
翻译
105阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格9:枚举

TypeScript语言规范9 枚举9.1 枚举声明9.2 枚举成员9.3 声明合并9.4 常量枚举声明9.5 代码生成9 枚举枚举类型是Number原语类型的独特子类型,具有一组关联的命名常量,这些常量定义了枚举类型的可能值。9.1 枚举声明枚举声明声明一个枚举类型和一个枚举对象。EnumDeclaration: constopt enum BindingIdentifier { EnumBodyopt }EnumDeclaration在包含的声明空间中引入了命名类型(枚举类型)和命名值(
翻译
127阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格8:类

TypeScript语言规范8 类8.1 类声明8.1.1 类继承规范8.1.2 类体8.2 成员8.2.1 实例成员和静态成员8.2.2 可访问性8.2.3 继承和重置8.2.4 class类型8.2.5 构造函数类型8.3 构造函数声明8.3.1 构造函数参数8.3.2 超类调用8.3.3 自动构造函数8.4 属性成员函数声明8.4.1 成员变量声明8.4.2 成员函数声明8.4.3 成员访问者声明8.4.4 动态属性声明8.5 索引成员声明8.6 装饰者8.7 代码生成8.7.1 无extends从句
翻译
88阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格7:接口

TypeScript语言规范7 接口7.1 接口声明7.2 声明合并7.3 接口扩展类7.4 动态类型检查7 接口接口提供了命名和参数化对象类型并将现有命名对象类型组合为新对象的能力。接口没有运行时表示—它们纯粹是编译时构造。 接口对于记录和验证所需的属性形状,作为参数传递的对象以及从函数返回的对象特别有用。因为TypeScript具有结构类型系统,所以具有一组特定成员的接口类型被认为与具有相同成员组的另一个接口类型或对象类型文字相同(并且可以替代)(请参阅第3.11.2节)。类声明可以在自己的I
翻译
116阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格6:函数

TypeScript语言规范6 函数6.1 函数声明6.2 函数重载6.3 函数实现6.4 析构参数声明6.5 通用函数6.6 代码生成6.7 生成函数6.8 异步函数6.9 类型保护函数6 函数TypeScript扩展了JavaScript函数,以包括类型参数,参数和返回类型注释,重载,默认参数值和rest参数。6.1 函数声明扩展了函数声明,以允许在重载声明中省略函数主体。FunctionDeclaration: ( Modified ) function BindingIdentifier
翻译
128阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格5:语句

TypeScript语言规范5 语句5.1 块5.2 变量语句5.2.1 简单变量声明5.2.2 析构变量声明5.2.3 implied类型5.3 let和const声明5.4 If,Do和While语句5.5 for语句5.6 for-in语句5.7 For-of语句5.8 Continue语句5.9 Break语句5.10 Return语句5.11 With语句5.12 Switch语句5.13 Throw语句5.14 Try语句5 语句本章介绍TypeScript为JavaScript语句提供的静
翻译
221阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格4:表达式

TypeScript语言规范4 表达式4.1 值和引用4.2 this关键字4.3 标识符4.4 文法4.5 Object文法4.6 数组文法4.7 模板文法4.8 括弧4.9 super关键字4.9.1 父类super调用4.9.2 父类属性存取4.10 函数表达式4.11 箭头函数4.12 Class表达式4.13 属性存取4.14 new操作算子4.15 函数调用4.15.1 重载解决方案4.15.2 类型参数推导4.15.3 语法歧义4.16 类型断言4.17 JSX表达式4.18 一元运算符4.1
翻译
240阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格3:类型

TypeScript语言规范3 类型3.1 Any类型3.2 基本类型3.2.1 Number类型3.2.2 Boolean类型3.2.3 String类型3.2.4 Symbol类型3.2.5 Void类型3.2.6 Null类型3.2.7 Undefined类型3.2.8 Enum类型3.2.9 String类型3.3 Object类型3.3.1 命名类型引用3.3.2 Array类型3.3.3 Tuple类型3.3.4 Function类型3.3.5 Constructor类型3.3.6 Member
翻译
185阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格2:基本概念

TypeScript语言规范2 基本概念2.1 语法约定2.2 命名2.2.1 保留字2.2.2 属性命名2.2.3 计算属性命名2.3 声明2.4 范围2 基本概念本文档的其余部分是TypeScript编程语言的正式规范,旨在作为ECMAScript 2015 Language Specification(特别是ECMA-262标准,第6版)的附件来阅读。 本文档描述了TypeScript所添加的语法,以及TypeScript编译器执行的编译时处理和类型检查,但是由于ECMAScript规范涵盖了该内
翻译
143阅读
0评论
0点赞
发布博客于 10 月前

[TypeScript] 编程实践之1: Google的TypeScript代码风格1:介绍

TypeScript语言规范1 介绍1.1 环境声明1.2 函数类型1.3 对象类型1.4 结构子类型化1.5 上下文类型推断1.6 类1.7 枚举类型1.8 字符串参数重载1.9 通用类型和功能1.10 命名空间1.11 模块版本1.82016年1月Microsoft自2012年10月1日起根据Open Web Foundation最终规范协议版本1.0(“ OWF 1.0”)提供此规范。OWF 1.0可以从http://www.openwebfoundation.org/legal/the-owf
翻译
315阅读
0评论
0点赞
发布博客于 10 月前

[Javascript] 编程实践之1: Google的Javascript代码风格9:附件

Google的Javascript风格指南9 附件9.1 JSDoc标签参考9.1.1 类型注释和其他Closure Compiler注释9.1.2 文档注释9.1.2.1 @author 或者 @owner - 不推荐9.1.2.2 @bug9.1.2.3 @code -弃用, 不推荐使用9.1.2.4 @desc9.1.2.5 @link9.1.2.6 @see9.1.2.7 @supported9.1.3 适用于特定框架的注释9.1.3.1 @ngInject 特定于Angular 19.1.3.2
翻译
138阅读
0评论
0点赞
发布博客于 1 年前

[Javascript] 编程实践之1: Google的Javascript代码风格8:一些策略

Google的Javascript风格指南8 一些策略8.1 Google样式指南未明确指出的问题:请保持一致性!8.2 编译器警告8.2.1 使用标准警告集8.2.2 如何处理警告8.2.3 在最窄的合理范围内禁止警告8.3 弃用8.4 代码不是Google风格8.4.1 重新格式化已有代码8.4.2 新加入的代码:请遵照Google风格8.5 本地风格规则8.6 生成的代码:大部分豁免8 一些策略8.1 Google样式指南未明确指出的问题:请保持一致性!对于本规范未明确解决的任何样式问题,请优先
翻译
105阅读
0评论
0点赞
发布博客于 1 年前

[Javascript] 编程实践之1: Google的Javascript代码风格7:JSDoc

Google的Javascript风格指南7 JSDoc7.1 通用形式7.2 Markdown7.3 JSDoc标签7.4 换行7.5 顶级/文件级注释7.6 类注释7.7 Enum和typedef注释7.8 方法和函数注释7.9 属性注释7.10 Type注释7.10.1 可空性7.10.2 类型转换7.10.3 模板参数类型7.10.4 函数类型表达式7.10.5 空格7.11 可见性注释7 JSDocJSDoc在所有类、域以及方法中被使用。7.1 通用形式在此示例中可以看到JSDoc块的基本
翻译
117阅读
0评论
0点赞
发布博客于 1 年前

[Javascript] 编程实践之1: Google的Javascript代码风格6:命名规范

Google的Javascript风格指南6 命名规范6.1 所有标识符的通用规则6.2 标识符类型规则6.2.1 Package命名6.2.2 Class命名6.2.3 Method命名6.2.4 Enum命名6.2.5 Constant命名6.2.5.1 “constant”的定义6.2.5.2 本地别名6.2.6 非常量域名称6.2.7 参数名称6.2.8 局部变量名称6.2.9 模板参数名称6.2.10 模块局部名称6.3 驼峰案例:定义6 命名规范6.1 所有标识符的通用规则标识符仅使用AS
翻译
218阅读
0评论
0点赞
发布博客于 1 年前

[Javascript] 编程实践之1: Google的Javascript代码风格5:语言特性

Google的Javascript风格指南5 语言特性5.1 局部变量声明5.1.1 const和let的使用5.1.2 每次只声明一个变量5.1.3 仅在需要时声明,并且尽快初始化5.1.4 根据需要声明类型5.2 数组文法5.2.1 使用拖拽逗号5.2.2 不要使用可变数组的构造函数5.2.3 非数值性质5.2.4 析构5.2.5 传播算子(Spread operator)5.3 对象文法5.3.1 使用拖拽逗号5.3.2 不要使用Object的构造函数5.3.3 不要混合使用含引号和不含引号的关键字5
翻译
134阅读
0评论
0点赞
发布博客于 1 年前

[Javascript] 编程实践之1: Google的Javascript代码风格4:格式化

Google的Javascript风格指南4 格式化4.1 大括弧4.1.1 在所有的控制结构中都使用大括弧4.1.2 非空块的K&R风格4.1.3 空块:可能更精炼4.2 块缩进:+2个空格4.2.1 数组文法:可类似于块4.2.2 对象文法:可类似于块4.2.3 类文法4.2.4 函数表达式4.2.5 Switch语句4.3 语句4.3.1 每行一条语句4.3.2 分号是必须的4.4 列数限制:804.5 换行4.5.1 在哪里做行中断4.5.2 缩进连续线至少+4个空格4.6 空格4.6.1
翻译
166阅读
0评论
0点赞
发布博客于 1 年前

[Javascript] 编程实践之1: Google的Javascript代码风格3:源文件结构

Google的Javascript风格指南3 源文件结构3.1 许可证或者版权信息(如果有)3.2 @fileoverview JSDoc (如果有)3.3 goog.module语句3.3.1 层次结构3.3.2 goog.module.declareLegacyNamespace3.3.3 goog.module导出3.4 ES模块3.4.1 导入3.4.1.1 导入路径3.4.1.1.1 在路径导入中的文件名扩展3.4.1.2 多次导入同一文件3.4.1.3 名称导入3.4.1.3.1 名称模块导入3
翻译
158阅读
0评论
0点赞
发布博客于 1 年前

[Javascript] 编程实践之1: Google的Javascript代码风格2:源文件基础

Google的Javascript风格指南2 源文件基础2.1 文件命名2.2 文件编码:UTF-82.3 特殊字符2.3.1 空格字符2.3.2 特殊转义序列2.3.3 非ASCII字符2 源文件基础2.1 文件命名文件名必须全部为小写,并且可以包含下划线(_)或者破折号(-),但不能包含其它标点符号。具体请遵循项目使用的约定。文件名的扩展名必须为.js。2.2 文件编码:UTF-8源文件编码方式为UTF-8。2.3 特殊字符2.3.1 空格字符除行终止符序列外,ASCII水平空格字符(0
翻译
84阅读
0评论
0点赞
发布博客于 1 年前

[Javascript] 编程实践之1: Google的Javascript代码风格1:简介

Google的Javascript风格指南内容目录1、简介1.1、术语注意事项1.2、规范注意事项2、源文件基础2.1、文件命名2.2、文件编码:UTF-82.3、特殊字符2.3.1、空格字符2.3.2、特殊转义序列2.3.3、非ASCII字符3、源文件结构3.1、许可证或者版权信息(如果有)3.2、@fileoverview JSDoc (如果有)3.3、goog.module语句4、格式5、语...
翻译
197阅读
0评论
0点赞
发布博客于 1 年前

[经典模型] 4. 图与网络模型及方法

4. 图与网络模型及方法图论起源于18 世纪。第一篇图论论文是瑞士数学家欧拉于1736 年发表的“哥尼斯堡的七座桥”。1847 年,克希霍夫为了给出电网络方程而引进了“树”的概念。1857年,凯莱在计数烷CnH2n+2CnH2n+2C_nH_{2n + 2}的同分异构物时,也发现了“树”。哈密尔顿于 1859 年提出“周游世界”游戏,用图论的术语,就是如何找出一个连通图中的生成圈、近几十年来,...
转载
1735阅读
0评论
1点赞
发布博客于 3 年前

[Leetcode] 823. Binary Trees With Factors 解题报告

题目:Given an array of unique integers, each integer is strictly greater than 1.We make a binary tree using these integers and each number may be used for any number of times.Each non-leaf node's value ...
原创
575阅读
1评论
0点赞
发布博客于 3 年前

[Leetcode] 822. Card Flipping Game 解题报告

题目:On a table are N cards, with a positive integer printed on the front and back of each card (possibly different).We flip any number of cards, and after we choose one card. If the number X on the bac...
原创
570阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 821. Shortest Distance to a Character 解题报告

题目:Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string.Example 1:Input: S = "loveleetcode", C = 'e'Output: [3, 2, 1, ...
原创
327阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 820. Short Encoding of Words 解题报告

题目:Given a list of words, we may encode it by writing a reference string S and a list of indexes A.For example, if the list of words is ["time", "me", "bell"], we can write it as S = "time#bell#" and ...
原创
1036阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 819. Most Common Word 解题报告

题目:Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words.  It is guaranteed there is at least one word that isn't banned, and that the ans...
原创
524阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 818. Race Car 解题报告

题目:Your car starts at position 0 and speed +1 on an infinite number line.  (Your car can go into negative positions.)Your car drives automatically according to a sequence of instructions A (accelerate...
原创
2826阅读
1评论
2点赞
发布博客于 3 年前

[Leetcode] 817. Linked List Components 解题报告

题目:We are given head, the head node of a linked list containing unique integer values.We are also given the list G, a subset of the values in the linked list.Return the number of connected components ...
原创
594阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 816. Ambiguous Coordinates 解题报告

题目:We had some 2-dimensional coordinates, like "(1, 3)" or "(2, 0.5)".  Then, we removed all commas, decimal points, and spaces, and ended up with the string S.  Return a list of strings representing ...
原创
468阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 482. License Key Formatting 解题报告

题目:You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes.Given a number K, we would
原创
203阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 815. Bus Routes 解题报告

题目:We have a list of bus routes. Each routes[i] is a bus route that the i-th bus repeats forever. For example if routes[0] = [1, 5, 7], this means that the first bus (0-th indexed) travels i
原创
1594阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 814. Binary Tree Pruning 解题报告

题目:We are given the head node root of a binary tree, where additionally every node's value is either a 0 or a 1.Return the same tree where every subtree (of the given tree) not containing
原创
296阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 813. Largest Sum of Averages 解题报告

题目:We partition a row of numbers A into at most K adjacent (non-empty) groups, then our score is the sum of the average of each group. What is the largest score we can achieve?Note that ou
原创
1157阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 812. Largest Triangle Area 解题报告

题目:You have a list of points in the plane. Return the area of the largest triangle that can be formed by any 3 of the points.Example:Input: points = [[0,0],[0,1],[1,0],[0,2],[2,0]]Output: 2
原创
1482阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 811. Subdomain Visit Count 解题报告

题目:A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.leet
原创
202阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 810. Chalkboard XOR Game 解题报告

题目:We are given non-negative integers nums[i] which are written on a chalkboard.  Alice and Bob take turns erasing exactly one number from the chalkboard, with Alice starting first.  If erasing
原创
403阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 809. Expressive Words 解题报告

题目:Sometimes people repeat letters to represent extra feeling, such as "hello" -> "heeellooo", "hi" -> "hiiii".  Here, we have groups, of adjacent letters that are all the same character, and ad
原创
639阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 808. Soup Servings 解题报告

题目:There are two types of soup: type A and type B. Initially we have N ml of each type of soup. There are four kinds of operations:Serve 100 ml of soup A and 0 ml of soup BServe 75 ml of s
原创
1099阅读
0评论
1点赞
发布博客于 3 年前

[Leetcode] 807. Max Increase to Keep City Skyline 解题报告

题目:In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the
原创
261阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 806. Number of Lines To Write String 解题报告

题目:We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 10
原创
280阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 805. Split Array With Same Average 解题报告

题目:In a given integer array A, we must move every element of A to either list B or list C. (B and C initially start empty.)Return true if and only if after such a move, it is possible that t
原创
2607阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 804. Unique Morse Code Words 解题报告

题目:International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a"maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and
原创
258阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 803. Bricks Falling When Hit 解题报告

题目:We have a grid of 1s and 0s; the 1s in a cell represent bricks.  A brick will not drop if and only if it is directly connected to the top of the grid, or at least one of its (4-way) adjacent
原创
1504阅读
0评论
1点赞
发布博客于 3 年前

[Leetcode] 802. Find Eventual Safe States 解题报告

题目:代码:In a directed graph, we start at some node and every turn, walk along a directed edge of the graph.  If we reach a node that is terminal (that is, it has no outgoing directed edges), we
原创
590阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 801. Minimum Swaps To Make Sequences Increasing 解题报告

题目:We have two integer sequences A and B of the same non-zero length.We are allowed to swap elements A[i] and B[i].  Note that both elements are in the same index position in their respe
原创
1466阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 800. Similar RGB Color 解题报告

题目:In the following, every capital letter represents some hexadecimal digit from 0 to f.The red-green-blue color "#AABBCC" can be written as "#ABC" in shorthand.  For example, "#15c" is sh
原创
1326阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 799. Champagne Tower 解题报告

题目:We stack glasses in a pyramid, where the first row has 1 glass, the second row has 2 glasses, and so on until the 100th row.  Each glass holds one cup (250ml) of champagne.Then, some cham
原创
279阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 798. Smallest Rotation with Highest Score 解题报告

题目:Given an array A, we may rotate it by a non-negative integer K so that the array becomes A[K], A[K+1], A{K+2], ... A[A.length - 1], A[0], A[1], ..., A[K-1].  Afterward, any entries that a
原创
872阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 797. All Paths From Source to Target 解题报告

题目:Given a directed, acyclic graph of N nodes.  Find all possible paths from node 0 to node N-1, and return them in any order.The graph is given as follows:  the nodes are 0, 1, ..., graph
原创
312阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 796. Rotate String 解题报告

题目:We are given two strings, A and B.A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, if A = 'abcde', then it will be 'b
原创
433阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 795. Number of Subarrays with Bounded Maximum 解题报告

题目:We are given an array A of positive integers, and two positive integers L and R (L ).Return the number of (contiguous, non-empty) subarrays such that the value of the maximum array elem
原创
582阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 794. Valid Tic-Tac-Toe State 解题报告

题目:A Tic-Tac-Toe board is given as a string array board. Return True if and only if it is possible to reach this board position during the course of a valid tic-tac-toe game.The board is a
原创
640阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 793. Preimage Size of Factorial Zeroes Function 解题报告

题目:Let f(x) be the number of zeroes at the end of x!. (Recall that x! = 1 * 2 * 3 * ... * x, and by convention, 0! = 1.)For example, f(3) = 0 because 3! = 6 has no zeroes at the end, whi
原创
673阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 792. Number of Matching Subsequences 解题报告

题目:Given string S and a dictionary of words words, find the number of words[i] that is a subsequence of S.Example :Input: S = "abcde"words = ["a", "bb", "acd", "ace"]Output: 3Explanatio
原创
295阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 791. Custom Sort String 解题报告

题目:S and T are strings composed of lowercase letters. In S, no letter occurs more than once.S was sorted in some custom order previously. We want to permute the characters of T so that t
原创
298阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 790. Domino and Tromino Tiling 解题报告

题目:We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may be rotated.XX <- dominoXX <- "L" trominoXGiven N, how many ways are there to tile a 2 x
原创
447阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 789. Escape The Ghosts 解题报告

题目:You are playing a simplified Pacman game. You start at the point (0, 0), and your destination is (target[0], target[1]). There are several ghosts on the map, the i-th ghost starts at (gho
原创
393阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 788. Rotated Digits 解题报告

题目:X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X.  Each digit must be rotated - we cannot choose to leave it alone.
原创
325阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 787. Cheapest Flights Within K Stops 解题报告

题目:There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w.Now given all the cities and fights, together with starting city src and the d
原创
837阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 786. K-th Smallest Prime Fraction 解题报告

题目:A sorted list A contains 1, plus some number of primes.  Then, for every p < q in the list, we consider the fraction p/q.What is the K-th smallest fraction considered?  Return your answ
原创
914阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 785. Is Graph Bipartite? 解题报告

题目:Given an undirected graph, return true if and only if it is bipartite.Recall that a graph is bipartite if we can split it's set of nodes into two independent subsets A and B such that e
原创
1677阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 784. Letter Case Permutation 解题报告

题目:Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string.  Return a list of all possible strings we could create.Examples:Input: S
原创
235阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 783. Minimum Distance Between BST Nodes 解题报告

题目:Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree.Example :Input: root = [4,2,6,1,3,nul
原创
285阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 782. Transform to Chessboard 解题报告

题目:An N x N board contains only 0s and 1s. In each move, you can swap any 2 rows with each other, or any 2 columns with each other.What is the minimum number of moves to transform the bo
原创
1274阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 781. Rabbits in Forest 解题报告

题目:In a forest, each rabbit has some color. Some subset of rabbits (possibly all of them) tell you how many other rabbits have the same color as them. Those answers are placed in an array.
原创
351阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 780. Reaching Points 解题报告

题目:A move consists of taking a point (x, y) and transforming it to either (x, x+y) or (x+y, y).Given a starting point (sx, sy) and a target point (tx, ty), return True if and only if a s
原创
260阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 779. K-th Symbol in Grammar 解题报告

题目:On the first row, we write a 0. Now in every subsequent row, we look at the previous row and replace each occurrence of 0 with 01, and each occurrence of 1 with 10.Given row N and ind
原创
367阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 778. Swim in Rising Water 解题报告

题目:On an N x N grid, each square grid[i][j] represents the elevation at that point (i,j).Now rain starts to fall. At time t, the depth of the water everywhere is t. You can swim from a s
原创
1000阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 777. Swap Adjacent in LR String 解题报告

题目:In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL", a move consists of either replacing one occurrence of "XL"with "LX", or replacing one occurrence of "RX" with "XR
原创
213阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 776. Split BST 解题报告

题目:Given a Binary Search Tree (BST) with root node root, and a target value V, split the tree into two subtrees where one subtree has nodes that are all smaller or equal to the target value, w
原创
1118阅读
0评论
1点赞
发布博客于 3 年前

[Leetcode] 775. Global and Local Inversions 解题报告

题目:We have some permutation A of [0, 1, ..., N - 1], where N is the length of A.The number of (global) inversions is the number of i  with 0  and A[i] > A[j].The number of local inve
原创
176阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 774. Minimize Max Distance to Gas Station 解题报告

题目:On a horizontal number line, we have gas stations at positions stations[0], stations[1], ..., stations[N-1], where N = stations.length.Now, we add K more gas stations so that D, the max
原创
1752阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 773. Sliding Puzzle 解题报告

题目:On a 2x3 board, there are 5 tiles represented by the integers 1 through 5, and an empty square represented by 0.A move consists of choosing 0 and a 4-directionally adjacent number and s
原创
834阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 772. Basic Calculator III 解题报告

题目:Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers
原创
3576阅读
0评论
1点赞
发布博客于 3 年前

[Leetcode] 771. Jewels and Stones 解题报告

题目:You're given strings J representing the types of stones that are jewels, and S representing the stones you have.  Each character in Sis a type of stone you have.  You want to know how man
原创
185阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 770. Basic Calculator IV 解题报告

题目:Given an expression such as expression = "e + 8 - a + 5" and an evaluation map such as {"e": 1} (given in terms of evalvars = ["e"] and evalints = [1]), return a list of tokens representi
原创
1709阅读
1评论
0点赞
发布博客于 3 年前

[Leetcode] 769. Max Chunks To Make Sorted 解题报告

题目:Given an array arr that is a permutation of [0, 1, ..., arr.length - 1], we split the array into some number of "chunks" (partitions), and individually sort each chunk.  After concatenating
原创
202阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 768. Max Chunks To Make Sorted II 解题报告

题目:Given an array arr of integers (not necessarily distinct), we split the array into some number of "chunks" (partitions), and individually sort each chunk.  After concatenating them, the res
原创
462阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 767. Reorganize String 解题报告

题目:Given a string S, check if the letters can be rearranged so that two characters that are adjacent to each other are not the same.If possible, output any possible result.  If not possibl
原创
807阅读
1评论
0点赞
发布博客于 3 年前

[Leetcode] 766. Toeplitz Matrix 解题报告

题目:A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element.Now given an M x N matrix, return True if and only if the matrix is Toeplitz. Example 1:Inp
原创
169阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 765. Couples Holding Hands 解题报告

题目:N couples sit in 2N seats arranged in a row and want to hold hands. We want to know the minimum number of swaps so that every couple is sitting side by side. A swap consists of choosing any t
原创
1268阅读
0评论
2点赞
发布博客于 3 年前

[Leetcode] 764. Largest Plus Sign 解题报告

题目:In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the given list mines which are 0. What is the largest axis-aligned plus sign of 1s contained in the
原创
815阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 763. Partition Labels 解题报告

题目:A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers repr
原创
241阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 762. Prime Number of Set Bits in Binary Representation 解题报告

题目:Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number of set bits in their binary representation.(Recall that the number of set b
原创
159阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 761. Special Binary String 解题报告

题目:Special binary strings are binary strings with the following two properties:The number of 0's is equal to the number of 1's.Every prefix of the binary string has at least as many 1's as
原创
1083阅读
2评论
0点赞
发布博客于 3 年前

[Leetcode] 760. Find Anagram Mappings 解题报告

题目:Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A.We want to find an index mapping P, from A to B.
原创
167阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 759. Employee Free Time 解题报告

题目:We are given a list schedule of employees, which represents the working time for each employee.Each employee has a list of non-overlapping Intervals, and these intervals are in sorted
原创
953阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 758. Bold Words in String 解题报告

题目:Given a set of keywords words and a string S, make all appearances of all keywords in S bold. Any letters between  and tags become bold.The returned string should use the least number
原创
493阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 757. Set Intersection Size At Least Two 解题报告

题目:An integer interval [a, b] (for integers a ) is a set of all consecutive integers from a to b, including a and b.Find the minimum size of a set S such that for every integer interval
原创
783阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 756. Pyramid Transition Matrix 解题报告

题目:We are stacking blocks to form a pyramid. Each block has a color which is a one letter string, like `'Z'`.For every block of color `C` we place not in the bottom row, we are placing it on
原创
954阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 755. Pour Water 解题报告

题目:We are given an elevation map, heights[i] representing the height of the terrain at that index. The width at each index is 1. After Vunits of water fall at index K, how much water is at e
原创
1843阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 754. Reach a Number 解题报告

题目:You are standing at position 0 on an infinite number line. There is a goal at position target.On each move, you can either go left or right. During the n-th move (starting from 1), you ta
原创
310阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 753. Cracking the Safe 解题报告

题目:There is a box protected by a password. The password is n digits, where each letter can be one of the first k digits 0, 1, ..., k-1.You can keep inputting the password, the password w
原创
882阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 752. Open the Lock 解题报告

题目:You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely and wrap around: for example
原创
461阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 751. IP to CIDR 解题报告

题目:Given a start IP address ip and a number of ips we need to cover n, return a representation of the range as a list (of smallest possible length) of CIDR blocks.A CIDR block is a string
原创
618阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 750. Number Of Corner Rectangles 解题报告

题目:Given a grid where each entry is only 0 or 1, find the number of corner rectangles.A corner rectangle is 4 distinct 1s on the grid that form an axis-aligned rectangle. Note that only the
原创
1626阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 749. Contain Virus 解题报告

题目:A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls.The world is modeled as a 2-D array of cells, where 0 represents uninfected cells, and 1
原创
565阅读
0评论
0点赞
发布博客于 3 年前

[Leetcode] 748. Shortest Completing Word 解题报告

题目:Find the minimum length word from a given dictionary words, which has all the letters from the string licensePlate. Such a word is said to complete the given string licensePlateHere,
原创
158阅读
0评论
0点赞
发布博客于 3 年前