当前位置:网站首页>Force buckle 2326, 197
Force buckle 2326, 197
2022-08-01 00:03:00 【Sister Tang】
197, SQL query
Table: Weather
+---------------+---------+| Column Name | Type |+---------------+---------+| id | int || recordDate | date || temperature | int |+---------------+---------+id is the primary key of this tableThe table contains temperature information for a specific date
Write an SQL query to find the id
of all dates with a warmer temperature than the previous (yesterday's) date.
Return results No order required.
The query result format is as follows.
Example 1:
Enter:Weather table:
+----+------------+-------------+| id | recordDate | Temperature |+----+------------+-------------+| 1 | 2015-01-01 | 10 || 2 | 2015-01-02 | 25 || 3 | 2015-01-03 | 20 || 4 | 2015-01-04 | 30 |+----+------------+-------------+Output:+----+| id |+----+| 2 || 4 |+----+Explanation:2015-01-02 the temperature was higher than the previous day (10 -> 25)2015-01-04 the temperature was higher than the previous day (20 -> 30)
select a.id from Weather as a, Weather as bwhere to_days(a.recordDate)=to_days(b.recordDate)+1 and a.Temperature>b.Temperature
2326 (movement of linked list)
You are given two integers: m and n, representing the dimensions of the matrix.
Also give you the head node head of a linked list of integers.
Please generate a spiral matrix of size m x n that contains all the integers in the linked list.The integers in the linked list start from the upper left corner of the matrix and are filled clockwise in spiral order.If there are any remaining spaces, they are padded with -1.
Returns the resulting matrix.
Example 1:
Input: m = 3, n = 5, head = [3,0,2,6,8,1,7,9,4,2,5,5,0]
Output:[[3,0,2,6,8],[5,0,-1,-1,1],[5,2,4,9,7]]
Explanation: The above figure shows the linked listHow are the integers arranged in the matrix.
Note that the remaining spaces in the matrix are padded with -1.
Example 2:
Input: m = 1, n = 4, head = [0,1,2]
Output: [[0,1,2,-1]]
Explanation: The above picture showsIt shows how the integers in the linked list are arranged from left to right in the matrix.
Note that the remaining spaces in the matrix are padded with -1.
Source: LeetCode
Link: https://leetcode.cn/problems/spiral-matrix-iv
The copyright belongs to LeetCode.com.For commercial reprints, please contact the official authorization, and for non-commercial reprints, please indicate the source.
/*** Definition for singly-linked list.* public class ListNode {* int val;*ListNode next;* ListNode() {}* ListNode(int val) { this.val = val; }* ListNode(int val, ListNode next) { this.val = val; this.next = next; }* }*/class Solution {public int[][] spiralMatrix(int m, int n, ListNode head) {// 1. Create a new array, fill it with -1 by defaultint[][] arr = new int[m][n];for(int i= 0;i=left;i--){if(head==null) return arr;arr[bottom][i]=head.val;head=head.next;}// move the lower bound upbottom--;}// 3.4 ↑if(top <= bottom&&left<=right) {for(int i =bottom;i>=top;i--){if(head==null) return arr;arr[i][left]=head.val;head=head.next;}// move left border to rightleft++;}}return arr;}}
边栏推荐
- 2022年最新重庆建筑八大员(电气施工员)模拟题库及答案
- 精心总结十三条建议,帮你创建更合适的MySQL索引
- /usr/local/bin和/usr/bin的区别
- TFC CTF 2022 WEB Diamand WriteUp
- Google Earth Engine——Error: Image.clipToBoundsAndScale, argument ‘input‘: Invalid type的错误解决
- 【云驻共创】【HCSD大咖直播】亲授大厂面试秘诀
- 编程语言是什么
- How to import a Golang external package and use it?
- 如何设计高可用高性能中间件 - 作业
- 基于mysql的消息队列设计
猜你喜欢
随机推荐
[Reading Notes -> Data Analysis] 02 Data Analysis Preparation
Compose原理-视图和数据双向绑定的原理
[Cloud Residency Co-Creation] [HCSD Big Celebrity Live Broadcast] Personally teach the secrets of interviews in big factories
新产品如何进行网络推广?
Google Earth Engine——Error: Image.clipToBoundsAndScale, argument ‘input‘: Invalid type的错误解决
力扣2326、197
Interview Blitz 69: Is TCP Reliable?Why?
Flutter教程之 01配置环境并运行demo程序 (教程含源码)
【MATLAB项目实战】LDPC-BP信道编码
The difference between /usr/local/bin and /usr/bin
面试突击69:TCP 可靠吗?为什么?
Interview Question: Implementing Deadlocks
IJCAI2022 | 代数和逻辑约束的混合概率推理
继承的注意事项
景区手绘地图的绘制流程
【FPGA教程案例43】图像案例3——通过verilog实现图像sobel边缘提取,通过MATLAB进行辅助验证
Web API Introduction and Types
面试突击69:TCP 可靠吗?为什么?
vim的基本使用-命令模式
WindowInsetsControllerCompat简单使用