Monday, July 28, 2014

TCHS SRM 44 Level one - 250 pt - Young Brother solution

TCHS SRM 44 Level one - 250 pt - Young Brother statement: http://community.topcoder.com/stat?c=problem_statement&pm=8252&rd=10795

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