leetcode column equal pairs

leetcode 197 上升的温度

上升的温度 date_add(interval expr type) 使用日期相加函数 select w1.id from Weather w1 left join Weather w2 on w1.recordDate = date_add(w2.recordDate, interval 1 da ......
leetcode 温度 197

leetcode 196 删除重复的电子邮箱

删除重复的电子邮箱 mysql 来说,inner join 是在做笛卡尔积 delete p1 from Person p1 inner join Person p2 on p1.email = p2.email and p1.Id > p2.Id delete p1 FROM person p1 ......
电子邮箱 leetcode 邮箱 电子 196

vue动态style el-table-column 状态 颜色

<el-table-column prop="processStatusName" label="状态" width="100" align="center" > <template slot-scope="scope"> <span :style="{ color: setColumnColor( ......
el-table-column 颜色 状态 动态 column

LeetCode 91. 解码方法

class Solution { public: int f[110]; bool check(char a,char b) { if(a>='1'&&a<='9'&&b>='0'&&b<='9') { int c=a-'0'; c=c*10+(b-'0'); if(c>=1&&c<=26) ret ......
LeetCode 方法 91

LeetCode #453 最小操作次数使数组元素相等

基本思路 每次让数组的n-1个元素加1——等价于——每次让一个元素减1; 把所有数加到相同的最大值 ——等价于——把所有的数捡到最小值; 因此最小操作次数 = 数组所有元素之和 - ( 数组长度 * 最小值); 标程 1 class Solution { 2 public: 3 int minMov ......
数组 LeetCode 元素 次数 453

leetcode 185

部门工资前三高的所有员工 select d.name as Department, e.name as Employee, e.salary as Salary from Employee e left join Department d on e.departmentId = d.Id where ......
leetcode 185

LeetCode #448 找到所有数组中消失的数字

基本思路 为了满足题目要求的不使用额外的存储空间(当然返回的数组除外),并且时间复杂度控制在O(n),最多只能常数级别遍历,因此考虑将原数组视作一个"哈希表"。 遍历原数组,将【1,n】上的值域映射到【0,n-】的坐标上,某个数x扫描到一次则将这个数x映射的 x-1的坐标处的值加上n。 然后再次遍历 ......
数组 LeetCode 数字 448

LeetCode #283 移动零(双指针版本,效率高)

基本思路 思路————双指针 初始状态左右指针都指向数组首位元素,然后right指针开始迭代数组,当碰到非0元素则与左指针left所在位置的元素交换。 交换完毕后,左指针left则向前移动到下一位置,做好准备迎接下一个非0元素的交换。 这种算法效率比之前撰写的“伪双指针”效率更高,更能应对特殊情况。 ......
指针 LeetCode 效率 版本 283

LeetCode #645 错误的集合

基本思路 用一个vector来模拟哈希表,记录每个元素的数量从而来找到重复的数和缺失的数。 标程 1 class Solution { 2 public: 3 vector<int> findErrorNums(vector<int>& nums) { 4 int n = nums.size(); ......
LeetCode 错误 645

LeetCode #697 数组的度

基本思路 需要知道数组中某些元素的出现次数来寻求最大出现次数,以及要找到长度最短的子数组长度。 因此可以考虑使用哈希表来记录某个元素出现的次数,第一个元素出现的下表,最后一个元素出现的下标。映射关系:x-->{times,starti,endj}。 标程 1 class Solution { 2 p ......
数组 LeetCode 697

LeetCode #414 第三大的数

解题思路数组从大到小排序后,从第2个元素开始遍历,如果与上一个元素不相同,则标志位++,标志位一旦从1加到3(两次)则代表存在第三大的数,即可返回。如若不存在第三大的数,则在遍历结束后,函数末尾返回数组的第一个元素(最大的元素)。 标程 1 class Solution { 2 public: 3 ......
LeetCode 三大 414

LeetCode #485 最大连续 1 的个数

解题思路基础题,最后加一个特殊情况处理就好,时间复杂度O(n) 代码 class Solution {public: int findMaxConsecutiveOnes(vector<int>& nums) { int count=0; int Maxcount=0; for(int i =0; ......
个数 LeetCode 485

4月11日leetcode练习

设计一个支持 push ,pop ,top 操作,并能在常数时间内检索到最小元素的栈。 实现 MinStack 类: MinStack() 初始化堆栈对象。void push(int val) 将元素val推入堆栈。void pop() 删除堆栈顶部的元素。int top() 获取堆栈顶部的元素。i ......
leetcode

php的TP框架保存数据报错: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x90\xA3\xF0\x9F...' for column

这一般情况就是保存表情字符导致的字符长度问题 原因可能: (需要改字符集为 utf8mb4 排序规则为 utf8mb4_general_ci) 1. 数据表字段不是utf8mb4 2.项目目录下文件 .env 里配置 mysql CHARSET = utf8 需要该为 CHARSET = utf8m ......
Incorrect xF0 x9F 框架 SQLSTATE

leetcode 184

部门工资最高的员工 select d.name as Department, e.name as Employee, e.salary as Salary from Employee e left join Department d on e.departmentId = d.id where (e ......
leetcode 184

leetcode 183

从不订购的客户 select c.Name as Customers from Customers c left join Orders o on c.Id = o.CustomerId where o.CustomerId is null select customers.name custome ......
leetcode 183

leetcode 182

查找重复的电子邮箱 select email as Email from Person group by email having count(email) > 1 select email as Email from ( select email ,count(email) as c from P ......
leetcode 182

leetcode 181

超过经理收入的员工 select e1.name as Employee from Employee e1, Employee e2 where e1.managerId = e2.id and e1.salary > e2.salary select e1.name as Employee fro ......
leetcode 181

【LeetCode回溯算法#extra01】集合划分问题【火柴拼正方形、划分k个相等子集、公平发饼干】

火柴拼正方形 https://leetcode.cn/problems/matchsticks-to-square/ 你将得到一个整数数组 matchsticks ,其中 matchsticks[i] 是第 i 个火柴棒的长度。你要用 所有的火柴棍 拼成一个正方形。你 不能折断 任何一根火柴棒,但你 ......
子集 正方形 正方 饼干 火柴

[LeetCode] 2390. Removing Stars From a String

You are given a string s, which contains stars *. In one operation, you can: Choose a star in s. Remove the closest non-star character to its left, as ......
LeetCode Removing String Stars 2390

leetcode 180

连续出现的数字 select distinct l1.num as ConsecutiveNums from Logs l1, Logs l2, Logs l3 where l1.id = l2.id - 1 and l2.id = l3.id - 1 and l1.num = l2.num and ......
leetcode 180

leetcode_打卡1

leetcode_打卡1 题目:1768. 交替合并字符串 解答: 思路: 模拟即可,字符串的提取: a.charAt(i) class Solution { public String mergeAlternately(String word1, String word2) { String re ......
leetcode

vue3 el-table-column 修改时间格式

根据element文档说明,el-table中的el-table-column 是可以使用 formatter 格式化时间的。 先添加 绑定函数 formatter <el-table-column prop="createdTimeFormat" :formatter="dateFormat" l ......
el-table-column 格式 时间 column table

leetcode 178

分数排名 select s1.score, count(distinct s2.score) as `rank` from Scores as s1, Scores as s2 where s1.score <= s2.score group by s1.id order by s1.score d ......
leetcode 178

leetcode 177

第N高的薪水 CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT BEGIN declare T int default 0; SET T = N-1; RETURN ( # Write your MySQL query statement ......
leetcode 177

LeetCode 959. 有斜杠划分区域

题目: https://leetcode.cn/problems/regions-cut-by-slashes/description/ 题解(参考了讨论区):将初始N*N的网格看做4 * N* N的三角形集合,根据输入合并对应的三角形。 C# 实现 public class Solution { ......
斜杠 LeetCode 区域 959

Leetcode(剑指offer专项训练)——DFS/BFS专项(3)

重建序列 题目 给定一个长度为 n 的整数数组 nums ,其中 nums 是范围为 [1,n] 的整数的排列。还提供了一个 2D 整数数组 sequences ,其中 sequences[i] 是 nums 的子序列。 检查 nums 是否是唯一的最短 超序列 。最短 超序列 是 长度最短 的序列 ......
专项 Leetcode offer DFS BFS

LeetCode习题——x 的平方根(二分查找)

### x 的平方根 力扣链接:[x 的平方根 ](https://leetcode.cn/problems/sqrtx/) #### 题目 > 给你一个非负整数 x ,计算并返回 x 的 算术平方根 。>> 由于返回类型是整数,结果只保留 整数部分 ,小数部分将被 舍去 。>> 注意:不允许使用任 ......
平方根 习题 LeetCode

【LeetCode动态规划#06】分割等和子集(01背包问题一维写法实战)

分割等和子集 分割等和子集 给你一个 只包含正整数 的 非空 数组 nums 。请你判断是否可以将这个数组分割成两个子集,使得两个子集的元素和相等。 示例 1: 输入:nums = [1,5,11,5] 输出:true 解释:数组可以分割成 [1, 5, 5] 和 [11] 示例 2: 输入:num ......
子集 写法 背包 实战 LeetCode

HBase在进行模型设计时重点在什么地方?一张表中定义多少个Column Family最合适?为什么?

锁屏面试题百日百刷,每个工作日坚持更新面试题。请看到最后就能获取你想要的,接下来的是今日的面试题: 1.Hbase中的memstore是用来做什么的? hbase为了保证随机读取的性能,所以hfile里面的rowkey是有序的。当客户端的请求在到达regionserver之后,为了保证写入rowke ......
模型 重点 地方 Column Family