摘要: 双指针法,结果只能从最左边或者最右边或者最左边加上最右边中取 class Solution { public: int findLengthOfShortestSubarray(vector<int>& arr) { int n = arr.size(),res = 1,res2 = 1,res3 阅读全文
posted @ 2023-03-26 07:53 智人心 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 静态链表 class Solution { public: int countStudents(vector<int>& students, vector<int>& sandwiches) { int stup = 0,sanp = 0,tmp; int n = students.size(),c 阅读全文
posted @ 2023-03-21 14:52 智人心 阅读(8) 评论(0) 推荐(0) 编辑
摘要: mysql的大小写转换,字符串连接函数 upper,lower,concat 阅读全文
posted @ 2023-03-21 07:54 智人心 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 注意map的按键和按值排序,按值排序需要转为vector #include<iostream> #include<map> #include<vector> #include<algorithm> using namespace std; int cmp(const pair<int,int>c1, 阅读全文
posted @ 2023-03-20 20:08 智人心 阅读(8) 评论(0) 推荐(0) 编辑
摘要: memset在填充的时候保证每个字节值相同 https://www.bbsmax.com/A/QV5Z8QEZzy/ 阅读全文
posted @ 2023-03-20 19:22 智人心 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 注意整行输入的格式 #include<iostream> #include<sstream> using namespace std; string reorderSpaces(string text) { string words[55]; int n = text.size(),cntWords 阅读全文
posted @ 2023-03-20 19:05 智人心 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 记得用sum,否则多条数据会冲突 # Write your MySQL query statement below select id, sum(case when month='Jan' then revenue else null end) Jan_Revenue, sum(case when 阅读全文
posted @ 2023-03-20 17:18 智人心 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 描述商人们喜欢使用方便记忆的电话号码。让号码方便记忆的一种方法是让它拼成好记的单词或词组。例如,你可以叫Waterloo大学TUT-GLOP。有时候只有数字的一部分参与拼写。当你回到家你可以打310-GINO预订Gino的披萨。另外一种使电话号方便记忆的方法是分组。你可以通过拨打3-10-10-10 阅读全文
posted @ 2023-01-25 15:46 智人心 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 问题描述 涉及大数乘幂运算和精度问题是很常见的一类问题。例如,国债的乘幂是许多计算机税务运算系统都避不开的问题。 现在要求你写程序计算R的n次幂,R是个实数(0.0<R<99.999)并且n是一个整数范围在0<n<=25以内。 输入 输入将包含一系列数对代表R和n。R的值在第1-6列,n在第8-9列 阅读全文
posted @ 2022-12-26 16:15 智人心 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 描述 计算A+B 输入 两个整数a,b(0<=a,b<=10) 输出 输出a+b 输入样例 1 2 输出样例 3 提示 问:输入和输出在哪里? 答:你的程序应该总是在标准输入读数据并向标准输出输出数据。例如,你可以用c语言的scanf或者c++的cin从标准输入读数据,用c语言的printf和c++ 阅读全文
posted @ 2022-12-26 15:59 智人心 阅读(22) 评论(0) 推荐(0) 编辑