is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
#include <iostream>
- Anonymous September 24, 2013using namespace std;
#include <vector>
#include <map>
#include <set>
#include <string>
void PopulateDictionary(std::set<string>& dict)
{
dict.insert("ab");
dict.insert("ba");
dict.insert("abab");
dict.insert("baba");
dict.insert("Flip");
dict.insert("kart");
dict.insert("Flipkarted");
dict.insert("Mobile");
dict.insert("A");
dict.insert("Apple");
dict.insert("Pie");
dict.insert("i");
}
typedef std::vector<string> StringVec;
bool FindPossibleWords(unsigned int strRemaining, unsigned int strSize, std::map<int, std::vector<string>>& HashMap, StringVec& strVec)
{
if (strRemaining == strSize)
return true;
if (HashMap.find(strRemaining) == HashMap.end())
return false;
StringVec words = HashMap[strRemaining];
for (unsigned int i = 0; i < words.size(); i++)
{
if (FindPossibleWords(words[i].size() + strRemaining,
strSize,
HashMap, strVec))
{
strVec.insert(strVec.begin(), words[i]);
return true;
}
}
return false;
}
int main()
{
string str("ApplePie");
unsigned int strSize = str.size();
std::set<string> dict;
std::map<int, std::vector<string>>HashMap;
PopulateDictionary(dict);
for (unsigned int i = 0; i < strSize; i++)
{
for (unsigned int j = i + 1; j < strSize; j++)
{
string sub = str.substr(i,j-i+1);
if (dict.find(sub) != dict.end())
{
//insert in hash map
HashMap[i].push_back(sub);
}
}
}
StringVec finalWords;
bool found = FindPossibleWords(0, strSize, HashMap, finalWords);
if (found)
{
for (unsigned int i = 0; i < finalWords.size(); i++)
cout<<finalWords[i]<<endl;
}
else
{
cout<<"No appropriate word was found\n";
}
return 0;
}