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.
Guys, I got a more clear solution for this. Just add a boolean for mode.
- jerry.mao.au July 17, 2013oh any one knows how to add tab??
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class ReverseData
{
public:
int low;
int high;
ReverseData():low(0),high(0)
{
}
};
void longest_sub(char* s);
int main(int argc, char* argv[])
{
char str[] = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth";
longest_sub(str);
int i;
cin>>i;
return 0;
}
void longest_sub(char* s)
{
vector<ReverseData*> myQueue;
bool reverseMode = false;
ReverseData* p;
int longest = 0;
int longestidx = -1;
size_t l = strlen(s);
for (int i = 1; i < l; i++)
{
if (!reverseMode)
{
if (s[i] == s[i-1])
{
reverseMode = true;
p = new ReverseData();
p->low = i -1;
p->high = i;
}
}
else
{
if (s[i] == s[p->low-1])
{
p->low--;
p->high = i;
}
else
{
myQueue.push_back(p);
reverseMode = false;
longest = max(longest, (p->high-p->low)+1);
if (longest == (p->high-p->low)+1)
longestidx = myQueue.size()-1;
}
}
}
if (longestidx>=0)
{
for (int i = myQueue[longestidx]->low; i <= myQueue[longestidx]->high; i++)
cout<<s[i];
cout<<endl;
}
}