作者DJYOSHITAKA (franchouchouISBEST)
看板Marginalman
標題Re: [閒聊] 每日leetcode
時間Wed Apr 10 21:19:36 2024
950. Reveal Cards In Increasing Order
好像只能照做 對呀==
vector<int> deckRevealedIncreasing(vector<int>& deck) {
queue<int> q;
for(int i=0; i<deck.size(); i++)
{
q.push(i);
}
sort(deck.begin(), deck.end());
vector<int> ans(deck.size(), 0);
int deck_idx = 0;
while(!q.empty())
{
ans[q.front()] = deck[deck_idx];
q.pop();
q.push(q.front());
q.pop();
deck_idx++;
}
return ans;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.138.89.231 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1712755178.A.2FD.html
推 SecondRun: 這到底什麼爛題 04/10 21:23
→ oinishere: 我覺得 這題 有夠 靠北 04/10 21:24
推 sustainer123: 浪費我一個小時 媽的 04/10 21:31
→ sustainer123: 我以為一定有規律 結果沒有 有夠靠北 04/10 21:32