当前位置:网站首页>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;}}
边栏推荐
猜你喜欢
Mysql environment installation under Linux (centos)
ICML2022 | 深入研究置换敏感的图神经网络
Matlab/Arcgis processing nc data
如何设计高可用高性能中间件 - 作业
基于单片机GSM的防火防盗系统的设计
网络安全--通过握手包破解WiFi(详细教程)
2022年最新重庆建筑八大员(电气施工员)模拟题库及答案
逐步手撕轮播图3(保姆级教程)
2022-07-31:给出一个有n个点,m条有向边的图, 你可以施展魔法,把有向边,变成无向边, 比如A到B的有向边,权重为7。施展魔法之后,A和B通过该边到达彼此的代价都是7。 求,允许施展一次魔法
[Reading Notes -> Data Analysis] 02 Data Analysis Preparation
随机推荐
基于mysql的消息队列设计
leetcode:126. 单词接龙 II
编译型语言和解释型语言的区别
Keil nRF52832 download failed
How to Design High Availability and High Performance Middleware - Homework
SQL injection Less42 (POST type stack injection)
In 2022, the latest eight Chongqing construction members (electrical construction workers) simulation question bank and answers
TFC CTF 2022 WEB Diamand WriteUp
Mysql environment installation under Linux (centos)
博弈论(Depu)与孙子兵法(42/100)
UOS统信系统 - WindTerm使用
Pylint检查规则中文版
助力数字政府建设,中科三方构建域名安全保障体系
2022-07-31:给出一个有n个点,m条有向边的图, 你可以施展魔法,把有向边,变成无向边, 比如A到B的有向边,权重为7。施展魔法之后,A和B通过该边到达彼此的代价都是7。 求,允许施展一次魔法
thymeleaf iterates the map collection
C# Rectangle basic usage and picture cutting
Interview Question: Implementing Deadlocks
zeno使用方法笔记
WindowInsetsControllerCompat简单使用
[QNX Hypervisor 2.2 User Manual]9.16 system