Are you with me, Werner? Right now?
Hello There?
Excuse me, Werner?
Excuse me Werner, you missed your deadline…
Must I do everything around here? Must be the AWS Developer currently developing away, during my time, of stolen FMLA Leave?.
Werner? Why do you fail so hard?
Werner and Developers? You missed your deadline. I’m guessing, even with Google at your disposal, you could not find me a solution. Why do I have to do everything myself?
I thought the hints were obvious. The key here is correlation… Werner what is your PhD in again?
For those of you wondering how I feel at this point given the failed part 1 delivery by the AWS CTO, that’s all I can really say about my feelings: I’m simply not impressed at all. The forms of exhaustion that have been attempted, against me, as yet another hail mary to attempt to escape the problem here at Amazon Corporate Village, leave me very unimpressed.. And hence, so that you developers and Werner are not at a loss for Part 2, this is one possible solution for Part 1. As you can tell, the polls are no longer showcasing duplicate answers.
Recall the given problem
Recall the abstract class
I was hoping the students would had filled in the rest of the missing context from viewing and/or inspecting the page and figuring out how best to implement the abstract scaffolding class given below.
via live.awsliu.com/teamblind
import correlate from “calculate-correlation“;
import { cloneDeep } from “lodash“;
export type PollAnswerData = {
x: number;
y: number;
r: number;
}
abstract class PollsDataInstance {
readonly MapStrPolls: Map<
string,
PollAnswerData
> | null;
constructor(
dataSet: PollAnswerData[] | Map<string, PollAnswerData>,
answers?: string[],
) {
if (dataSet instanceof Map<string, PollAnswerData>) {
this.MapStrPolls = cloneDeep<Map<string, PollAnswerData>>(dataSet);
} else if (dataSet instanceof Array && answers instanceof Array) {
this.MapStrPolls = new Map<
string,
PollAnswerData
>();
answers.forEach((answer, index) => {
this.MapStrPolls?.set(answer, dataSet[index]);
})
} else {
this.MapStrPolls = null;
}
}
public getPollsDataSet(): PollAnswerData[] {
return Array.from(this.MapStrPolls != null ? this.MapStrPolls.values() : []);
}
public abstract getPollsDataSetWithoutReplicants(): Map<
string,
PollAnswerData
>;
}
And here’s one way to implement the Abstract class
export class PollsData extends PollsDataInstance {
public getPollsDataSetWithoutReplicants(minCoefficient = 0.9996): Map<
string,
PollAnswerData
> {
const replicants: {
key: string;
replicant: string;
}[] = [];
const MapStrPollsNoReplicantsAllowed = new Map<
string,
PollAnswerData
>();
for (const [answer, dataObj] of this.MapStrPolls?.entries() || []) {
const { x, y, r } = dataObj;
let replicantFound = false;
for (const nonReplicantAnswer of MapStrPollsNoReplicantsAllowed.keys()) {
if (answer.length < ‘Wages paid dec 21st‘.length) {
break;
}
const savedAnswerAsciiArray = nonReplicantAnswer
.split(“”)
.map((val) => val.charCodeAt(0));
const answerAsciiArray = answer
.split(“”)
.map((val) => val.charCodeAt(0));
const corrs = correlate(
savedAnswerAsciiArray.splice(
0,
Math.min(nonReplicantAnswer.length, answerAsciiArray.length)
),
answerAsciiArray.splice(
0,
Math.min(nonReplicantAnswer.length, answerAsciiArray.length)
)
);
// console.log(corrs);
if ((1 – Math.abs(corrs)) >= minCoefficient) {
let savedAnwerKey: string;
if (answer.length > nonReplicantAnswer.length) {
MapStrPollsNoReplicantsAllowed.delete(nonReplicantAnswer);
savedAnwerKey = answer;
} else {
savedAnwerKey = nonReplicantAnswer;
}
MapStrPollsNoReplicantsAllowed.set(savedAnwerKey, {
x:
x +
(MapStrPollsNoReplicantsAllowed.get(nonReplicantAnswer)?.x || 0),
y:
y < 0
? Math.min(
y,
MapStrPollsNoReplicantsAllowed.get(nonReplicantAnswer)?.y ||
0
)
: Math.max(
y,
MapStrPollsNoReplicantsAllowed.get(nonReplicantAnswer)?.y ||
0
),
r: Math.max(
r,
MapStrPollsNoReplicantsAllowed.get(nonReplicantAnswer)?.r || 0
),
});
replicantFound = true;
replicants.push({
key: nonReplicantAnswer,
replicant: answer,
});
break;
}
}
if (!replicantFound) {
MapStrPollsNoReplicantsAllowed.set(answer, {
x,
y,
r,
});
}
}
return MapStrPollsNoReplicantsAllowed;
}
}
Werner AWS CTO, can you just be a good CTO and get my work email account working? Is that too much to ask? This kind of stuff might be above your role and expectation, but at least a work email account, working for atoz.ziping.work for atoz.amazon.work, is that asking the impossible from your Technical Operational Leadership ability?
Hey Werner… Lighten up, props to you for not blocking me on Twitter like @aselipsky did. Or at least not yet. You see, @aselipsky is pretty much:
Like this:
Like Loading...
Related