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.
---adding the check for possibility
- bahador.biglar April 10, 2015boolean fancy_shuffle(s: string)
{
var
a: array [0..255] of integer;
m: int;
ParseString(s, a); // after this we know count of each character
// a contains the count of each ascii code in string s
m := -1; // which one just printed, set to -1 as nothing is printed yet.
if length(s)>0
return WriteTheNewString(a, m, length(s));
}
ParseString(s: string, a: array of int)
{
for i=0 to 255 do
a[i]=0;
for i=1 to length(s) do
{
a[ascii(s[i])] = a[ascii(s[i])] + 1;
}
}
WriteTheNewString(a, m, l)
{
// l is how much chars remained to get printed
if l = 0 return 0;
max:=0;
pos:=-1;
for i=0 to 255 do // find the character with max remaining count
{
if a[i] > max and m<>i
{
max:=a[i];
pos:=i;
}
}
if pos==-1 return -1;
write(char(a[pos]));
m:=pos;
a[pos]:=a[pos]-1;
WriteTheNewString(a, m, l-1);
}