<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          ?LeetCode刷題實戰(zhàn)618:學生地理信息報告

          共 1114字,需瀏覽 3分鐘

           ·

          2022-05-27 16:11

          算法的重要性,我就不多說了吧,想去大廠,就必須要經(jīng)過基礎(chǔ)知識和業(yè)務(wù)邏輯面試+算法面試。所以,為了提高大家的算法能力,這個公眾號后續(xù)每天帶大家做一道算法題,題目就從LeetCode上面選 !

          今天和大家聊的問題叫做?學生地理信息報告,我們先來看題面:
          https://leetcode.cn/problems/students-report-by-geography/

          示例


          解題


          1.新增1列,給3個洲的學生分別按照姓名順序排名,使用row_number() over (order by ) 函數(shù),這樣有3個表

          2.將3個表按照排名列聯(lián)接起來

          select?America, Asia, Europe
          from?
          (select?name?as?America,row_number()?over?(order?by?name?ASC)?as?rn?from?student?where?continent='America') a
          left?join
          (select?name?as?Asia,row_number()?over?(order?by?name?ASC)?as?rn?from?student?where?continent='Asia') b
          on?a.rn=b.rn
          left?join
          (select?name?as?Europe,row_number()?over?(order?by?name?ASC)?as?rn?from?student?where?continent='Europe') c
          on?c.rn=a.rn


          上期推文:
          LeetCode1-600題匯總,希望對你有點幫助!
          LeetCode刷題實戰(zhàn)601:體育館的人流量
          LeetCode刷題實戰(zhàn)602:好友申請 II :誰有最多的好友
          LeetCode刷題實戰(zhàn)603:連續(xù)空余座位
          LeetCode刷題實戰(zhàn)604:迭代壓縮字符串
          LeetCode刷題實戰(zhàn)605:種花問題
          LeetCode刷題實戰(zhàn)606:根據(jù)二叉樹創(chuàng)建字符串
          LeetCode刷題實戰(zhàn)607:銷售員
          LeetCode刷題實戰(zhàn)608:樹節(jié)點
          LeetCode刷題實戰(zhàn)609:在系統(tǒng)中查找重復文件
          LeetCode刷題實戰(zhàn)610:判斷三角形
          LeetCode刷題實戰(zhàn)611:有效三角形的個數(shù)
          LeetCode刷題實戰(zhàn)612:平面上的最近距離
          LeetCode刷題實戰(zhàn)613:直線上的最近距離
          LeetCode刷題實戰(zhàn)614:二級關(guān)注者
          LeetCode刷題實戰(zhàn)615:平均工資:部門與公司比較
          LeetCode刷題實戰(zhàn)616:給字符串添加加粗標簽
          LeetCode刷題實戰(zhàn)617:合并二叉樹

          瀏覽 27
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  操逼逼片| 婷婷爱爱蜜臀天天操 | 欧美激情视频网站 | 91aaa国产精品 | 美颜巨乳-熊猫成人网 |