討論串[閒聊] 每日leetcode
共 1497 篇文章

推噓2(2推 0噓 5→)留言7則,0人參與, 1年前最新作者DJYOSHITAKA (franchouchouISBEST)時間1年前發表 (2024/03/11 14:53), 1年前編輯資訊
0
0
0
內容預覽:
791. Custom Sort String. 你板大師都好猛. 剩我只會水桶了. string customSortString(string order, string s) {. vector<int> cnt(26,0);. for(auto c : s). {. cnt[c-'a']++
(還有233個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者yam276 (史萊哲林的優等生)時間1年前 (2024/03/11 14:02), 編輯資訊
0
0
1
內容預覽:
差不多思路. 先建order map. 然後把str變成Vec比對order map. 不在order map就塞後面. 最後拼回來. use std::collections::HashMap;. impl Solution {. pub fn custom_sort_string(order:
(還有341個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者UsadaBeguora (兔田背鍋拉)時間1年前 (2024/03/11 11:37), 編輯資訊
0
0
0
內容預覽:
寫到一半發現處長站在我後面看. 下午在產線躲了半天. 我要怎麼無聲無息地回去拿包包下班. 除了金蟬脫殼. 姆咪. --. 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.34.86.192 (臺灣). 文章網址: https://www.ptt.cc/bbs/Marginalman/M

推噓1(1推 0噓 1→)留言2則,0人參與, 1年前最新作者NCKUEECS (小惠我婆)時間1年前 (2024/03/11 03:56), 編輯資訊
0
0
1
內容預覽:
大師寫得好精簡我不獻醜了. 我用c寫 跑老半天都沒過. 最後發現忘記加'\0'. 我好爛:(. 恨c. --. 發信站: 批踢踢實業坊(ptt.cc), 來自: 218.164.231.134 (臺灣). 文章網址: https://www.ptt.cc/bbs/Marginalman/M.

推噓3(3推 0噓 1→)留言4則,0人參與, 1年前最新作者sustainer123 (caster )時間1年前 (2024/03/11 02:45), 編輯資訊
0
0
1
內容預覽:
思路:. 用字典紀錄順序 之後sorted排序. 為了避免key error 所以使用dic.get() 假如x不在dic 回傳27. Python Code:. class Solution:. def customSortString(self, order: str, s: str) -> s
(還有89個字)