五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

database_leetcode 2173. Longest Winning Streak (Hard)

2022-02-18 20:23 作者:您是打尖兒還是住店呢  | 我要投稿

/*

2173. Longest Winning Streak


Table: Matches


+-------------+------+

| Column Name | Type |

+-------------+------+

| player_id? ?| int? |

| match_day? ?| date |

| result? ? ? | enum |

+-------------+------+

(player_id, match_day) is the primary key for this table.

Each row of this table contains the ID of a player, the day of the match they played, and the result of that match.

The result column is an ENUM type of ('Win', 'Draw', 'Lose').

?


The winning streak of a player is the number of consecutive wins uninterrupted by draws or losses.


Write an SQL query to count the longest winning streak for each player.


Return the result table in any order.


The query result format is in the following example.


?


Example 1:


Input:?

Matches table:

+-----------+------------+--------+

| player_id | match_day? | result |

+-----------+------------+--------+

| 1? ? ? ? ?| 2022-01-17 | Win? ? |

| 1? ? ? ? ?| 2022-01-18 | Win? ? |

| 1? ? ? ? ?| 2022-01-25 | Win? ? |

| 1? ? ? ? ?| 2022-01-31 | Draw? ?|

| 1? ? ? ? ?| 2022-02-08 | Win? ? |

| 2? ? ? ? ?| 2022-02-06 | Lose? ?|

| 2? ? ? ? ?| 2022-02-08 | Lose? ?|

| 3? ? ? ? ?| 2022-03-30 | Win? ? |

+-----------+------------+--------+

Output:?

+-----------+----------------+

| player_id | longest_streak |

+-----------+----------------+

| 1? ? ? ? ?| 3? ? ? ? ? ? ? |

| 2? ? ? ? ?| 0? ? ? ? ? ? ? |

| 3? ? ? ? ?| 1? ? ? ? ? ? ? |

+-----------+----------------+

Explanation:?

Player 1:

From 2022-01-17 to 2022-01-25, player 1 won 3 consecutive matches.

On 2022-01-31, player 1 had a draw.

On 2022-02-08, player 1 won a match.

The longest winning streak was 3 matches.


Player 2:

From 2022-02-06 to 2022-02-08, player 2 lost 2 consecutive matches.

The longest winning streak was 0 matches.


Player 3:

On 2022-03-30, player 3 won a match.

The longest winning streak was 1 match.




database_leetcode 2173. Longest Winning Streak (Hard)的評論 (共 條)

分享到微博請遵守國家法律
安化县| 兴化市| 荣昌县| 平乡县| 乌拉特后旗| 河间市| 土默特左旗| 嘉荫县| 黑山县| 高平市| 尼勒克县| 外汇| 宁强县| 广汉市| 嘉鱼县| 平阴县| 勃利县| 遵义市| 巩义市| 新乡县| 吉林市| 哈巴河县| 金坛市| 天祝| 桂林市| 丹阳市| 桃园县| 达尔| 钟祥市| 阿巴嘎旗| 淳化县| 江西省| 惠安县| 临夏县| 上犹县| 米脂县| 铁力市| 土默特右旗| 灌云县| 广州市| 稷山县|