討論串[閒聊] 每日leetcode
共 1497 篇文章
內容預覽:
791. Custom Sort String. 你板大師都好猛. 剩我只會水桶了. string customSortString(string order, string s) {. vector<int> cnt(26,0);. for(auto c : s). {. cnt[c-'a']++
(還有233個字)
內容預覽:
差不多思路. 先建order map. 然後把str變成Vec比對order map. 不在order map就塞後面. 最後拼回來. use std::collections::HashMap;. impl Solution {. pub fn custom_sort_string(order:
(還有341個字)
內容預覽:
思路:. 用字典紀錄順序 之後sorted排序. 為了避免key error 所以使用dic.get() 假如x不在dic 回傳27. Python Code:. class Solution:. def customSortString(self, order: str, s: str) -> s
(還有89個字)