TCHS SRM 44 Level one - 250 pt - Young Brother editorial: http://community.topcoder.com/tc?module=Static&d1=hs&d2=match_editorials&d3=hs_srm44
TCHS SRM 44 Level one - 250 pt - Young Brother solution:
#include <iostream> #include <vector> class YoungBrother{ public: std::vector <std::string> restoreWords(std::vector <std::string> l, int n, int k) { std::string s=""; std::vector <std::string> ans; for(int i=0; i<l.size(); i++) s+=l[i]; for(int i=0, j=0; i<n; i++, j+=k) ans.push_back(s.substr(j, k)); return ans; } };
No comments:
Post a Comment