chore(Blind): add answer key and solutions for deduction problems

This commit is contained in:
Prad Nukala
2026-07-13 12:15:42 -04:00
parent 090189ccf7
commit 04a9e82fc3
7 changed files with 547 additions and 0 deletions
+82
View File
@@ -0,0 +1,82 @@
// ============================================================
// BLIND DEDUCTION SET — Monday evening, ONE round, then stop.
// The 6 core interview problems, disguised exactly as they'd
// appear Tuesday: no statement, just input => output pairs.
// Rules: deduce the rule, SAY it in one sentence out loud,
// state the plan (freq map? sort? tiebreak?), then implement.
// Do NOT open blind-deduction-answers.js until finished.
// Target: rule stated < 3 min, implemented < 6 min each.
// ============================================================
// ---- problem1 ----
// problem1([8, 1, 2, 2, 3]) => [4, 0, 1, 1, 3]
// problem1([6, 5, 4, 8]) => [2, 1, 0, 3]
// problem1([7, 7, 7, 7]) => [0, 0, 0, 0]
// problem1([3, 1, 2]) => [2, 0, 1]
// problem1([5]) => [0]
// problem1([4, 1, 4, 1]) => [2, 0, 2, 0]
function problem1(arr) {
// your code
}
// ---- problem2 ----
// problem2("tree") => "eert"
// problem2("cccaaa") => "aaaccc"
// problem2("Aabb") => "bbaA"
// problem2("z") => "z"
// problem2("bookkeeper") => "eeekkoobpr"
// problem2("mississippi") => "iiiissssppm"
function problem2(str) {
// your code
}
// ---- problem3 ----
// problem3([1, 1, 2, 2, 2, 3]) => [3, 1, 1, 2, 2, 2]
// problem3([2, 3, 1, 3, 2]) => [1, 3, 3, 2, 2]
// problem3([-1, 1, -6, 4, 5, -6, 1, 4, 1]) => [5, -1, 4, 4, -6, -6, 1, 1, 1]
// problem3([9]) => [9]
// problem3([5, 5, 4, 4]) => [5, 5, 4, 4]
function problem3(arr) {
// your code
}
// ---- problem4 ----
// problem4("leetcode") => 0
// problem4("loveleetcode") => 2
// problem4("aabb") => -1
// problem4("x") => 0
// problem4("aabbc") => 4
// problem4("aa") => -1
function problem4(str) {
// your code
}
// ---- problem5 ----
// problem5("anagram", "nagaram") => true
// problem5("rat", "car") => false
// problem5("a", "ab") => false
// problem5("", "") => true
// problem5("aacc", "ccac") => false
// problem5("listen", "silent") => true
function problem5(s, t) {
// your code
}
// ---- problem6 ----
// problem6([1, 1, 1, 2, 2, 3], 2) => [1, 2]
// problem6([1], 1) => [1]
// problem6([4, 4, 4, 6, 6, 7, 7, 7, 7], 2) => [7, 4]
// problem6([5, 5, 5, 5], 1) => [5]
// problem6([3, 0, 1, 0], 1) => [0]
// problem6([2, 2, 3, 3, 1], 3) => [2, 3, 1]
function problem6(arr, k) {
// your code
}
// ---- harness: uncomment per problem after implementing ----
// console.log(problem1([8, 1, 2, 2, 3]), problem1([4, 1, 4, 1]));
// console.log(problem2("tree"), problem2("bookkeeper"));
// console.log(problem3([2, 3, 1, 3, 2]), problem3([5, 5, 4, 4]));
// console.log(problem4("loveleetcode"), problem4("aabbc"));
// console.log(problem5("anagram", "nagaram"), problem5("aacc", "ccac"));
// console.log(problem6([4, 4, 4, 6, 6, 7, 7, 7, 7], 2), problem6([2, 2, 3, 3, 1], 3));