SQL刷题+Java急救

Scanner java.util包提供的一个类 使用前导入该包

        char ch = 'k';
        System.out.println("请输入单个字符");
        try {
            ch = (char) System.in.read();
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println(ch);
        
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入单个字符");
        char ch = scanner.next().charAt(0);
        System.out.println(ch);

输入多个字符 ctrl+p不知道数据类型的时候看下

read 默认返回类型是int

public class IOput {
    public static void main(String[] args) throws IOException {
        System.out.println("请输入一行字符串");
        byte[] bytes = new byte[1001];
        int n = System.in.read(bytes);
        for (int i = 0; i < n; i++) {
            System.out.println((char) bytes[i]);
        }

    }
}

7.1建党节被我说成了建军节。。。怪不得我没有思想觉悟呢

Sql的题目真的要常刷常新啊 还是要制定学习计划

连续的id题目 都是用id-rk

Leetcode601.体育馆的人流量(困难)

机智套路方法- 大数据处理下的方法

with t1 as(
SELECT  *,rank() over(order by id ),id-rank() over(order by id )  as rk from stadium 
where people>=100
)

SELECT id,visit_date,people from t1
where rk in(select rk from t1 
GROUP BY rk 
having count(rk)>=3)

呆瓜方法

SELECT  DISTINCT s1.*  from stadium s1,stadium s2,stadium s3

where s1.people>100 and s2.people>100 and s3.people>100
and (
        S1.id +1 = S2.id AND S1.id+2=S3.id OR
    S1.id +1 = S2.id AND S1.id-1=S3.id OR
    S1.id -1 = S2.id AND S1.id-2=S3.id
)
order by s1.id 

Leetcode_608. 树节点

case when 语句中间没有逗号

SELECT *,
    case
    when p_id is null then 'ROOT'
    when id in (SELECT DISTINCT p_id FROM tree) then 'Inner'
    else 'Leaf' end  as type 
from tree    


java 相关 

二维数组定义:int array[][] = new int[3][3];
获取行数: int rowLength = array.length;
获取列数: int colLength = array[0].length;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值