题号leetcode题目

leetcode top100-01

最好能说明一下为什么不怕重复。看评论里有很多人提出这个问题,说hash冲突。 我在这里解答一下这个问题。 1.每次写入时,判断条件 不是当前的key本身存不存在,而是key和 tag 之间的差值存不存在,这一点很重要。 2.题目命题说明了一点,假定只有一个解。也就是说重复元素再多都无所谓。 case ......
leetcode 100 top 01

leetcode top100 - 02

坑 转换成数字进行运算,最后转换成链表。可能会出现溢出的情况。 因为无论是int还是long类型表达的数字长度是有限的,而链表的长度是可以无限追加的。 解释是干扰你的,其实就是依次从低位到高位的进位过程 笔试思路 把链表依次填充到数组中,数组容易操作,然后逐位进行加法运算; 面试思路 使用链表的思路 ......
leetcode 100 top 02

Leetcode19. 删除链表的倒数第 N 个结点

19. 删除链表的倒数第 N 个结点 自己纯手写第一题,递归有点冗杂,开辟了虚拟头节点,而且要特别注意边界条件(当倒数第n个正好是头节点时)。 ** * Definition for singly-linked list. * struct ListNode { * int val; * ListN ......
结点 Leetcode 19

总结三次题目集的知识点、题量、难度等情况

前言:题目集1是Java入门,大至涵盖了Java的几种基本语言结构,如循环,选择,数组。与c语言大致相似,上手较容易。但是题目难度不低,7-10GPS数据处理,不仅题目长难以理解,对有难度的字符串要求掌握熟练,输出要考虑的情况也很多,题目也达12题之多。其他题目在c语言里写过近似一模一样的题,写这个 ......
知识点 难度 题目 情况 知识

MySQL练习题目 及答案

表创建及创建见文章最后 1、取得每个部门最高薪水的人员名称 select t.deptno,t.maxsal,e.ename from emp e join (select max(sal) as maxsal,deptno from emp group by deptno) t on e.sal ......
题目 答案 MySQL

代码随想录Day16-Leetcode104. 二叉树的最大深度,111.二叉树的最小深度 ,222.完全二叉树的节点个数

104. 二叉树的最大深度 首先是层序遍历 /** * Definition for a binary tree node. * function TreeNode(val, left, right) { * this.val = (val undefined ? 0 : val) * this.l ......
深度 随想录 节点 随想 个数

LeetCode 287. 寻找重复数

LeetCode 287. 寻找重复数 题目 \287. 寻找重复数 中等 2.1K 相关企业 给定一个包含 n + 1 个整数的数组 nums ,其数字都在 [1, n] 范围内(包括 1 和 n),可知至少存在一个重复的整数。 假设 nums 只有 一个重复的整数 ,返回 这个重复的数 。 你设 ......
LeetCode 287

代码随想录Day15-Leetcode102. 二叉树的层序遍历,226.翻转二叉树,101. 对称二叉树

102. 二叉树的层序遍历 题目链接:https://leetcode.cn/problems/binary-tree-level-order-traversal/ bfs,队列,记录下本层的数量和下一层的数量 /** * Definition for a binary tree node. * f ......
随想录 随想 Leetcode 代码 Day

【DP】LeetCode 剑指 Offer 60. n个骰子的点数

题目链接 剑指 Offer 60. n个骰子的点数 思路 动态规划问题中,只用考虑第 n 个阶段如何由第 n-1 个阶段转化过来 在本题中,就是投掷 n 个骰子的结果如何由 投掷 n-1 个骰子的结果转化过来。 代码 class Solution { public double[] dicesPro ......
骰子 点数 LeetCode Offer 60

【LBLD】双指针技巧秒杀七道链表题目

【LBLD】双指针技巧秒杀七道链表题目 原文地址:双指针技巧秒杀七道链表题目 合并两个有序链表 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() ......
指针 题目 技巧 LBLD

leetcode-1089-easy

Duplicate Zeros Given a fixed-length integer array arr, duplicate each occurrence of zero, shifting the remaining elements to the right. Note that ele ......
leetcode 1089 easy

leetcode-1009-easy

Complement of Base 10 Integer The complement of an integer is the integer you get when you flip all the 0's to 1's and all the 1's to 0's in its binar ......
leetcode 1009 easy

leetcode-1317-easy

Convert Integer to the Sum of Two No-Zero Integers No-Zero integer is a positive integer that does not contain any 0 in its decimal representation. Gi ......
leetcode 1317 easy

【LeetCode】35.搜索插入位置

题目描述 解法 思路:二分查找 class Solution { public: int searchInsert(vector<int>& nums, int target) { int left = 0, right = nums.size() - 1; int count = 0; if(nu ......
LeetCode 位置 35

【LeetCode】278.第一个错误的版本

题目描述 解法 思路:二分查找 注意:当第一个 isBadVersion(mid)的结果为true时,得到第一个错误的版本 // The API isBadVersion is defined for you. // bool isBadVersion(int version); class Sol ......
LeetCode 错误 版本 278

【LeetCode】704.二分查找

题目描述 解法 class Solution { public: int search(vector<int>& nums, int target) { int left = 0; int right = nums.size()-1; while(left <= right){ int mid = ......
LeetCode 704

leetcode 176

leetcode 176 第二高的薪水,查第二高的人的信息 1、使用ifnull(exp1, exp2)函数,limit offset子句 select ifnull( (select distinct salary from Employee order by salary desc limit ......
leetcode 176

代码随想录Day14-Leetcode144. 二叉树的前序遍历,94.二叉树的中序遍历,145.二叉树的后序遍历

递归遍历 前序遍历:根左右 一路俯冲,然后回头 /** * Definition for a binary tree node. * function TreeNode(val, left, right) { * this.val = (val undefined ? 0 : val) * this ......
随想录 随想 Leetcode 代码 Day

2021 年蓝桥杯第一次省赛题目全解答

做题链接:A组 B组 C组 填空题 卡片 直接模拟。 展开代码 #include <bits/stdc++.h> using ll = long long; int main() { std::cin.tie(nullptr)->sync_with_stdio(false); std::map<ch ......
蓝桥 题目 第一次 2021

LeetCode 1641 统计字典序元音字符串的数目

给你一个整数 n,请返回长度为 n 、仅由元音 (a, e, i, o, u) 组成且按 字典序排列 的字符串数量。 字符串 s 按 字典序排列 需要满足:对于所有有效的 i,s[i] 在字母表中的位置总是与 s[i + 1] 相同或在 s[i + 1] 之前。 示例 1: 输入:n = 1 输出: ......
元音 字符串 数目 字典 字符

【DFS】LeetCode 110. 平衡二叉树

题目链接 110. 平衡二叉树 思路 一个空树肯定是平衡二叉树,并且一个平衡二叉树的子树也是平衡二叉树。利用这两条性质我们可以推断出代码中含有 root == null -> return true 和 isBalanced(root.left) && isBalanced(root.right)。 ......
LeetCode DFS 110

C语言题目

#include <stdio.h> int main() { int a,b; scanf("%d %d",&a,&b); printf("%d+%d=%d\n",a,b,a+b); printf("%d-%d=%d\n",a,b,a-b); printf("%d*%d=%d\n",a,b,a*b ......
题目 语言

Leetcode81. 搜索旋转排序数组 II

class Solution { public: bool check(vector<int> &nums,int target,int l,int r)//[l,r]区间查找target { while(l<r) { int mid=(l+r+1)>>1; if(target>=nums[mid] ......
数组 Leetcode 81 II

【单调队列】LeetCode 面试题59 - II. 队列的最大值

题目链接 面试题59 - II. 队列的最大值 思路 可以看参考题解:如何解决 O(1) 复杂度的 API 设计题 一开始想到使用单变量 max 来存储最大值,但是会产生两点问题: 当 max 弹出队列之后,下一个最大值是多少没法知道 如果有多个 max,那么当一个最大值弹出队列之后,队列中还有没有 ......
队列 最大值 LeetCode II

【单调队列】LeetCode 239. 滑动窗口最大值

题目链接 239. 滑动窗口最大值 思路 单调队列的使用方法,将滑动窗口 代码 class Solution { public int[] maxSlidingWindow(int[] nums, int k) { int[] result = new int[nums.length - k + 1 ......
最大值 队列 LeetCode 239

【ACM算法竞赛日常训练】DAY5题解与分析【储物点的距离】【糖糖别胡说,我真的不是签到题目】| 前缀和 | 思维

DAY5共2题: 储物点的距离(前缀和) 糖糖别胡说,我真的不是签到题目(multiset,思维) 🎈 作者:Eriktse 🎈 简介:19岁,211计算机在读,现役ACM银牌选手🏆力争以通俗易懂的方式讲解算法!❤️欢迎关注我,一起交流C++/Python算法。(优质好文持续更新中……)🚀 ......
题解 前缀 算法 题目 思维

LeetCode 1092 最短公共超序列

LeetCode | 1092.最短公共超序列 给出两个字符串 str1 和 str2,返回同时以 str1 和 str2 作为子序列的最短字符串。如果答案不止一个,则可以返回满足条件的任意一个答案。 (如果从字符串 T 中删除一些字符(也可能不删除,并且选出的这些字符可以位于 T 中的 任意位置) ......
序列 LeetCode 1092

链表操作-leetcode 92 -反转链表2

题目描述: 给你单链表的头指针 head 和两个整数 left 和 right ,其中 left <= right 。请你反转从位置 left 到位置 right 的链表节点,返回 反转后的链表 。 示例: 输入:head = [1,2,3,4,5], left = 2, right = 4 输出: ......
leetcode 92

[LeetCode] 2068. Check Whether Two Strings are Almost Equivalent

Two strings word1 and word2 are considered almost equivalent if the differences between the frequencies of each letter from 'a' to 'z' between word1 a ......
Equivalent LeetCode Whether Strings Almost

一些面试高频题目

1.跨域问题?同源策略?怎么解决跨域问题 跨域问题是指在浏览器中,当一个Web应用程序向一个不同源(例如协议、域名或端口不同)的Web应用程序发起请求时,浏览器会阻止请求。这是由于浏览器的同源策略所导致的,同源策略要求Web应用程序只能访问与其本身来源相同的资源。跨域问题的解决方法有如下几种: JS ......
题目