当前位置:网站首页>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.Temperature2326 (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;}} 边栏推荐
- 开源好用的 流程图绘制工具 drawio
- Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads
- 基于单片机GSM的防火防盗系统的设计
- 编程语言是什么
- Usage of mysql having
- 基于simulink的Passive anti-islanding-UVP/OVP and UFP/OFP被动反孤岛模型仿真
- SQL注入 Less47(报错注入) 和Less49(时间盲注)
- Carefully summarize thirteen suggestions to help you create more suitable MySQL indexes
- 虹科分享|如何用移动目标防御技术防范未知因素
- 一体化步进电机在无人机自动机场的应用
猜你喜欢
随机推荐
Flink 1.13(八)CDC
消息队列存储消息数据的MySQL表格
[MATLAB project combat] LDPC-BP channel coding
EntityFramework保存到SQLServer 小数精度丢失
手写一个简单的web服务器(B/S架构)
Thinking and Implementation of Object Cache Service
[QNX Hypervisor 2.2 User Manual]9.16 system
Advanced Algebra _ Proof _ Any matrix is similar to an upper triangular matrix
二叉树遍历非递归程序 -- 使用栈模拟系统栈
Difference between first and take(1) operators in NgRx
Interview Blitz 69: Is TCP Reliable?Why?
Xinao Learning Plan The Road to Informatics Competition (2022.07.31)
C# Rectangle基本用法和图片切割
NIO programming
SQL注入 Less54(限制次数的SQL注入+union注入)
网络安全--通过握手包破解WiFi(详细教程)
Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
UOS统信系统 - WindTerm使用
《ArchSummit:时代的呐喊,技术人听得到》
Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads









