# num 80

What if duplicates are allowed at most twice?

For example,
Given sorted array nums = `[1,1,1,2,2,3]`,

Your function should return length = `5`, with the first five elements of nums being `1``1``2``2` and `3`. It doesn‘t matter what you leave beyond the new length.

```class Solution {
public:
int removeDuplicates(vector<int>& nums) {
vector<int>::size_type it1;
vector<int>::size_type it2;
int time=0;
if(nums.size()<2) return nums.size();
for(it1=0,it2=1;it2<nums.size();it2++)
{
if(nums[it1]==nums[it2]&&time==0)
{
nums[++it1]=nums[it2];
time++;
}
else if(nums[it1]!=nums[it2])
{
nums[++it1]=nums[it2];
time=0;
}
}
return it1+1;

}
};```

## [转载]SQL语句练习

2.查询"生物"课程比"物理"课程成绩高的所有学生的学号: 思路: 获取所有有生物课程的人(学号,成绩) - 临时表 获取所有有物理课程的人(学号,成绩) - 临时表 根据[学号]连接两个临时表: 学号 物理成绩 生物成绩 然后再进行筛选 select A.student_id,sw,ty from (select student_id,num as sw from score left join course on score.course_id = course

## 数据库经典习题，

/* 数据导入: Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50624 Source Host : localhost Source Database : sqlexam Target Server Type : MySQL Target Server Version : 50624 File Encoding : utf-8

## python3 mysql 多表查询

python3 mysql 多表查询 一.准备表 创建二张表: company.employee company.department #建表 create table department( id int, name varchar(20) ); create table employee( id int primary key auto_increment, name varchar(20), sex enum('male','female') not null default 'male'

## 笔记4

[[email protected] ~]# declare -i i=10[[email protected] ~]# declare -i j=10 declare -i[[email protected] ~]# n=i+j[[email protected] ~]# echo \$ni+j[[email protected] ~]# n=\$i+\$j[[email protected] ~]# echo \$n10+10[[email protected] ~]# declare -i n=i