06 2021 档案

99. 恢复二叉搜索树
摘要:题目描述 给你二叉搜索树的根节点 root ,该树中的两个节点被错误地交换。请在不改变其结构的情况下,恢复这棵树。 示例 2: 输入: [3,1,4,null,null,2] 3 / \66 1 4 / 2 输出: [2,1,4,null,null,3] 2 / \ 1 4 / 3 进阶: 使用 O 阅读全文

posted @ 2021-06-14 23:58 朴素贝叶斯 阅读(45) 评论(0) 推荐(0) 编辑

98. 验证二叉搜索树
摘要:题目描述 Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows: The left subtree of a node contains 阅读全文

posted @ 2021-06-14 22:21 朴素贝叶斯 阅读(24) 评论(0) 推荐(0) 编辑

230. 二叉搜索树中第K小的元素
摘要:题目描述 给定一个二叉搜索树,编写一个函数 kthSmallest 来查找其中第 k 个最小的元素。 说明: 你可以假设 k 总是有效的,1 ≤ k ≤ 二叉搜索树元素个数。 示例 1: 输入: root = [3,1,4,null,2], k = 1 3 / \ 1 4 \ 2 输出: 1 示例 阅读全文

posted @ 2021-06-14 20:13 朴素贝叶斯 阅读(33) 评论(0) 推荐(0) 编辑

117. 填充每个节点的下一个右侧节点指针 II
摘要:题目描述 Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your lastvious solutio 阅读全文

posted @ 2021-06-14 18:56 朴素贝叶斯 阅读(34) 评论(0) 推荐(0) 编辑

116. 填充每个节点的下一个右侧节点指针
摘要:题目描述 Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate(填充) each next pointer to point 阅读全文

posted @ 2021-06-14 17:15 朴素贝叶斯 阅读(31) 评论(0) 推荐(0) 编辑

124. 二叉树中的最大路径和
摘要:题目描述 Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree. For example: Given the below binary tree, 1 / 阅读全文

posted @ 2021-06-14 15:58 朴素贝叶斯 阅读(38) 评论(0) 推荐(0) 编辑

107. Binary Tree Level Order Traversal II
摘要:题目描述 Given a binary tree, return the bottom-up level order traversal of its nodes values. (ie, from left to right, level by level from leaf to root). 阅读全文

posted @ 2021-06-14 14:25 朴素贝叶斯 阅读(22) 评论(0) 推荐(0) 编辑

111. 二叉树的最小深度
摘要:题目描述 给定一个二叉树,找出其最小深度。 最小深度是从根节点到最近叶子节点的最短路径上的节点数量。 说明: 叶子节点是指没有子节点的节点。 示例: 给定二叉树 [3,9,20,null,null,15,7], 3 / 9 20 / 15 7 返回它的最小深度 2. /** * Definition 阅读全文

posted @ 2021-06-14 13:06 朴素贝叶斯 阅读(29) 评论(0) 推荐(0) 编辑

104. Maximum Depth of Binary Tree
摘要:题目描述 Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthe 阅读全文

posted @ 2021-06-14 11:17 朴素贝叶斯 阅读(13) 评论(0) 推荐(0) 编辑

103. Binary Tree Zigzag Level Order Traversal
摘要:题目描述 Given a binary tree, return the zigzag level order traversal f its nodes values.(ie, from left to right, then right to left for the next level an 阅读全文

posted @ 2021-06-14 10:02 朴素贝叶斯 阅读(23) 评论(0) 推荐(0) 编辑

102. Binary Tree Level Order Traversal
摘要:题目描述 Given a binary tree, 返回 the level order traversal of its nodes values.(ie, from left to right,level by level). For example: Given binary tree{3,9 阅读全文

posted @ 2021-06-14 08:46 朴素贝叶斯 阅读(21) 评论(0) 推荐(0) 编辑

110. Balanced Binary Tree
摘要:题目描述 Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the 阅读全文

posted @ 2021-06-14 07:08 朴素贝叶斯 阅读(18) 评论(0) 推荐(0) 编辑

216. 组合总和 III
摘要:题目描述 找出所有相加之和为 n 的 k 个数的组合。组合中只允许含有 1 - 9 的正整数,并且每种组合中不存在重复的数字。 说明: 所有数字都是正整数。解集不能包含重复的组合。 示例 1: 输入: k = 3, n = 7 输出: [[1,2,4]] 示例 2: 输入: k = 3, n = 9 阅读全文

posted @ 2021-06-13 20:36 朴素贝叶斯 阅读(40) 评论(0) 推荐(0) 编辑

40. 组合总和 II
摘要:题目描述 Given a collection of candidate numbers ( C ) and a target number ( T ),find all unique combinations in C where the candidate numbers sums to T . 阅读全文

posted @ 2021-06-13 19:45 朴素贝叶斯 阅读(36) 评论(0) 推荐(0) 编辑

39. 组合总和
摘要:题目描述 Given a set of candidate numbers ( C ) and a target number ( T ),find all unique combinations in C where the candidate numbers sums to T .The sam 阅读全文

posted @ 2021-06-13 18:57 朴素贝叶斯 阅读(36) 评论(0) 推荐(0) 编辑

77. 组合
摘要:题目描述 给定两个整数 n 和 k,返回 1 ... n 中所有可能的 k 个数的组合。 示例: 输入: n = 4, k = 2 输出: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] 方法1 思路 没有剪枝的暴力dfs 以1-n这n个位置的情况进行遍历 阅读全文

posted @ 2021-06-13 18:16 朴素贝叶斯 阅读(29) 评论(0) 推荐(0) 编辑

172. 阶乘后的零
摘要:题目描述 给定一个整数 n,返回 n! 结果尾数中零的数量。 示例 1: 输入: 3 输出: 0 解释: 3! = 6, 尾数中没有零。 示例 2: 输入: 5 输出: 1 解释: 5! = 120, 尾数中有 1 个零. 说明: 你算法的时间复杂度应为 O(log n) 。 思路 其实也就是求阶乘 阅读全文

posted @ 2021-06-13 17:13 朴素贝叶斯 阅读(33) 评论(0) 推荐(0) 编辑

268. 缺失数字
摘要:题目描述 给定一个包含 0, 1, 2, ..., n 中 n 个数的序列,找出 0 .. n 中没有出现在序列中的那个数。 示例 1: 输入: [3,0,1] 输出: 2 示例 2: 输入: [9,6,4,2,3,5,7,0,1] 输出: 8 说明: 你的算法应具有线性时间复杂度。你能否仅使用额外 阅读全文

posted @ 2021-06-13 16:27 朴素贝叶斯 阅读(30) 评论(0) 推荐(0) 编辑

260. 只出现一次的数字 III
摘要:题目描述 给定一个整数数组 nums,其中恰好有两个元素只出现一次,其余所有元素均出现两次。 找出只出现一次的那两个元素。 示例 : 输入: [1,2,1,3,2,5] 输出: [3,5] 注意: 结果输出的顺序并不重要,对于上面的例子, [5, 3] 也是正确答案。你的算法应该具有线性时间复杂度。 阅读全文

posted @ 2021-06-13 15:46 朴素贝叶斯 阅读(24) 评论(0) 推荐(0) 编辑

137. Single Number II
摘要:题目描述 Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear run 阅读全文

posted @ 2021-06-13 15:12 朴素贝叶斯 阅读(14) 评论(0) 推荐(0) 编辑

136. Single Number
摘要:题目描述: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime 阅读全文

posted @ 2021-06-13 14:25 朴素贝叶斯 阅读(29) 评论(0) 推荐(0) 编辑

206. 反转链表
摘要:题目描述 反转一个单链表。 示例: 输入: 1->2->3->4->5->NULL 输出: 5->4->3->2->1->NULL 进阶: 你可以迭代或递归地反转链表。你能否用两种方法解决这道题? /** * Definition for singly-linked list. * struct L 阅读全文

posted @ 2021-06-13 13:36 朴素贝叶斯 阅读(21) 评论(0) 推荐(0) 编辑

70. Climbing Stairs
摘要:题目描述 You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can yo 阅读全文

posted @ 2021-06-13 12:55 朴素贝叶斯 阅读(35) 评论(0) 推荐(0) 编辑

101. Symmetric Tree
摘要:题目描述 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 阅读全文

posted @ 2021-06-13 12:17 朴素贝叶斯 阅读(34) 评论(0) 推荐(0) 编辑

100. Same Tree
摘要:题目描述 Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identic 阅读全文

posted @ 2021-06-13 11:42 朴素贝叶斯 阅读(26) 评论(0) 推荐(0) 编辑

96. Unique Binary Search Trees
摘要:题目描述 Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 uniqu 阅读全文

posted @ 2021-06-13 11:16 朴素贝叶斯 阅读(31) 评论(0) 推荐(0) 编辑

95. Unique Binary Search Trees II
摘要:题目描述 Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n = 3, your program should retu 阅读全文

posted @ 2021-06-13 10:13 朴素贝叶斯 阅读(27) 评论(0) 推荐(0) 编辑

109. 有序链表转换二叉搜索树
摘要:题目描述 Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. /** * Definition for singly-linked 阅读全文

posted @ 2021-06-13 09:15 朴素贝叶斯 阅读(24) 评论(0) 推荐(0) 编辑

108. 将有序数组转换为二叉搜索树
摘要:题目描述 Given an array where elements are sorted in ascending order,convert it to a height balanced BST. /** * Definition for binary tree * struct TreeNo 阅读全文

posted @ 2021-06-13 08:12 朴素贝叶斯 阅读(30) 评论(0) 推荐(0) 编辑

106. Construct Binary Tree from Inorder and Postorder Traversal
摘要:题目描述 Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. /** * 阅读全文

posted @ 2021-06-13 07:20 朴素贝叶斯 阅读(33) 评论(0) 推荐(0) 编辑

105. Construct Binary Tree from Preorder and Inorder Traversal
摘要:题目描述 Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. /** * D 阅读全文

posted @ 2021-06-13 06:35 朴素贝叶斯 阅读(25) 评论(0) 推荐(0) 编辑

43. 字符串相乘
摘要:题目描述 Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are no 阅读全文

posted @ 2021-06-12 22:36 朴素贝叶斯 阅读(51) 评论(0) 推荐(0) 编辑

6. Z 字形变换
摘要:题目描述 将一个给定字符串根据给定的行数,以从上往下、从左到右进行 Z 字形排列。比如输入字符串为 "LEETCODEISHIRING" 行数为 3 时,排列如下: L C I R E T O E S I I G E D H N 之后,你的输出需要从左往右逐行读取,产生出一个新的字符串,比如:"LC 阅读全文

posted @ 2021-06-12 21:21 朴素贝叶斯 阅读(82) 评论(0) 推荐(0) 编辑

21. 合并两个有序链表
摘要:题目描述 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. /** 阅读全文

posted @ 2021-06-12 20:09 朴素贝叶斯 阅读(43) 评论(0) 推荐(0) 编辑

61. 旋转链表
摘要:题目描述 Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k =2,return 4->5->1-> 阅读全文

posted @ 2021-06-12 19:22 朴素贝叶斯 阅读(19) 评论(0) 推荐(0) 编辑

19. 删除链表的倒数第N个节点
摘要:题目描述 Given a linked list, remove the n th node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. Aft 阅读全文

posted @ 2021-06-12 18:05 朴素贝叶斯 阅读(29) 评论(0) 推荐(0) 编辑

143. 重排链表
摘要:题目描述 给定一个单链表 L:L0→L1→…→Ln-1→Ln ,将其重新排列后变为: L0→Ln→L1→Ln-1→L2→Ln-2→…你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。 示例 1: 给定链表 1->2->3->4, 重新排列为 1->4->2->3. 示例 2: 给定链表 阅读全文

posted @ 2021-06-12 16:21 朴素贝叶斯 阅读(45) 评论(0) 推荐(0) 编辑

234. 回文链表
摘要:题目描述 请判断一个链表是否为回文链表。 示例 1: 输入: 1->2 输出: false 示例 2: 输入: 1->2->2->1 输出: true 进阶: 你能否用 O(n) 时间复杂度和 O(1) 空间复杂度解决此题? /** * Definition for singly-linked li 阅读全文

posted @ 2021-06-12 12:20 朴素贝叶斯 阅读(45) 评论(0) 推荐(0) 编辑

203. 移除链表元素
摘要:题目描述 删除链表中等于给定值 val 的所有节点。 示例: 输入: 1->2->6->3->4->5->6, val = 6 输出: 1->2->3->4->5 /** * Definition for singly-linked list. * struct ListNode { * int v 阅读全文

posted @ 2021-06-12 11:15 朴素贝叶斯 阅读(29) 评论(0) 推荐(0) 编辑

237. 删除链表中的节点
摘要:题目描述 请编写一个函数,使其可以删除某个链表中给定的(非末尾)节点,你将只被给定要求被删除的节点。 现有一个链表 -- head = [4,5,1,9],它可以表示为: 示例 1: 输入: head = [4,5,1,9], node = 5 输出: [4,1,9] 解释: 给定你链表中值为 5 阅读全文

posted @ 2021-06-12 10:25 朴素贝叶斯 阅读(32) 评论(0) 推荐(0) 编辑

160. 相交链表
摘要:题目描述 编写一个程序,找到两个单链表相交的起始节点。 如下面的两个链表: 在节点 c1 开始相交。 示例 1: 输入:intersectVal = 8, listA = [4,1,8,4,5], listB = [5,0,1,8,4,5], skipA = 2, skipB = 3 输出:Refe 阅读全文

posted @ 2021-06-12 09:51 朴素贝叶斯 阅读(30) 评论(0) 推荐(0) 编辑

129. 求根到叶子节点数字之和
摘要:题目描述 Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 阅读全文

posted @ 2021-06-12 09:02 朴素贝叶斯 阅读(33) 评论(0) 推荐(0) 编辑

113. Path Sum II
摘要:题目描述 Given a binary tree and a sum, find all root-to-leaf paths where each paths sum equals the given sum. For example: Given the below binary tree an 阅读全文

posted @ 2021-06-12 08:16 朴素贝叶斯 阅读(28) 评论(0) 推荐(0) 编辑

112. Path Sum
摘要:题目描述 Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given s 阅读全文

posted @ 2021-06-12 07:13 朴素贝叶斯 阅读(37) 评论(0) 推荐(0) 编辑

226. 翻转二叉树
摘要:题目描述 翻转一棵二叉树。 示例: 输入: 4 / 2 7 / \ / 1 3 6 9 输出: 4 / 7 2 / \ / 9 6 3 1 备注: 这个问题是受到 Max Howell 的 原问题 启发的 : 谷歌:我们90%的工程师使用您编写的软件(Homebrew),但是您却无法在面试时在白板上 阅读全文

posted @ 2021-06-12 06:25 朴素贝叶斯 阅读(35) 评论(0) 推荐(0) 编辑

预训练语言模型Bert算法原理
摘要:概述 BERT的全称是Bidirectional Encoder Representation from Transformers,是论文BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding中 阅读全文

posted @ 2021-06-08 20:27 朴素贝叶斯 阅读(1347) 评论(0) 推荐(0) 编辑

预训练语言模型Open AI GPT算法原理
摘要:概述 Open AI GPT是OpenAI 团队在论文Improving Language Understanding by Generative Pre-Training中提出的预训练语言模型,他们的目标是学习一个通用的表示,能够在大量任务上进行应用。核心思想是先通过无标签的文本去训练生成语言模型 阅读全文

posted @ 2021-06-07 19:58 朴素贝叶斯 阅读(1904) 评论(0) 推荐(0) 编辑

语言模型的评价指标之困惑度
摘要:无论是n-gram语言模型(unigram, bigram, tirgram),还是理论上可以记忆无限个单词的无穷元语法(∞-gram)和递归神经网络语言模型(RNN Language Model),都会涉及到一个最关键的问题:如何来评价这些语言模型的好坏? 语言模型是很多涉及到产生文字或预测文字概 阅读全文

posted @ 2021-06-05 22:23 朴素贝叶斯 阅读(2988) 评论(0) 推荐(0) 编辑

预训练语言模型ELMo算法原理
摘要:概述 2018年,论文《Deep Contextualized(语境化) Word Representations》中提出了ELMo,即Embeddings from Language Models。作者认为一个预训练的词表示应该具备以下特点: 能够包含丰富的句法和语义信息 能够对多义词进行建模。 阅读全文

posted @ 2021-06-05 20:41 朴素贝叶斯 阅读(696) 评论(0) 推荐(0) 编辑

语言模型(Language Model)
摘要:语言模型简单来说就是一串词序列的概率分布。具体来说,语言模型的作用是为一个长度为m的文本确定一个概率分布P,表示这段文本存在的可能性。在实践中,如果文本的长度较长,$P(w_i | w_1, w_2, . . . , w_{i−1})$的估算会非常困难。因此,研究者们提出使用一个简化模型:n元模型( 阅读全文

posted @ 2021-06-05 20:01 朴素贝叶斯 阅读(1433) 评论(0) 推荐(0) 编辑

用图解说Transformer模型
摘要:对应的英文地址The Illustrated Transformer 概述 前一段时间谷歌推出的BERT模型在11项NLP任务中夺得SOTA结果,引爆了整个NLP界。而BERT取得成功的一个关键因素是Transformer的强大作用。谷歌的Transformer模型最早是用于机器翻译任务,当时达到了 阅读全文

posted @ 2021-06-04 21:03 朴素贝叶斯 阅读(1070) 评论(0) 推荐(0) 编辑

transformers中,关于PreTrainedTokenizer的使用
摘要:在我们使用transformers进行预训练模型学习及微调的时候,我们需要先对数据进行预处理,然后经过处理过的数据才能“喂”进bert模型里面,这这个过程中我们使用的主要的工具就是tokenizer。你可以建立一个tokenizer通过与相关预训练模型相关的tokenizer类,例如,对于Rober 阅读全文

posted @ 2021-06-02 22:33 朴素贝叶斯 阅读(5907) 评论(0) 推荐(0) 编辑

transformers 中,bert模型的输出
摘要:通常我们在利用Bert模型进行NLP任务时,需要针对特定的NLP任务,在Bert模型的下游,接上针对特定任务的模型,因此,我们就十分需要知道Bert模型的输出是什么,以方便我们灵活地定制Bert下游的模型层,本文针对Bert的一个pytorch实现transformers库,来探讨一下Bert的具体 阅读全文

posted @ 2021-06-01 22:01 朴素贝叶斯 阅读(6105) 评论(0) 推荐(1) 编辑

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

统计

点击右上角即可分享
微信分享提示