[Daily] 2021-06-21 MON

Movie Recommendation

  • Plan: 6/28

LeetCode

Today: String

1451. Rearrange Words in a Sentence
map bucket solution

Better Solution: additional stringstream & map

  • stringstream
  while(ss >> word)
  
  for(auto p: m) rs << p.second;
  
  • map: (same length of word) add to end of the string
  m[word.size()] += word + " ";
  

Reminder

  • <cctype>: toupper(), tolower(), isupper(), islower()