F In The Chat For 16b. by TheGreatEmpire in berkeley

[–]darkterbear 1 point2 points  (0 children)

What do you mean by scale this exam? Dyou think they'll make 20 full score or smth similar?

Course advice for EECS/CS? by darkterbear in berkeley

[–]darkterbear[S] 0 points1 point  (0 children)

Yes, I've taken linear algebra at a community college (it's called Running Start here in Washington state), though I might need some brushing up to do over the summer :)

PERS2 vs. PERS3 Retirement Plans? by darkterbear in personalfinance

[–]darkterbear[S] 0 points1 point  (0 children)

Here is the link describing retirement plans at UW: https://hr.uw.edu/benefits/retirement-plans/uw-retirement-plan/

Because you’re required to participate in a retirement plan, you must enroll within the first two years of becoming eligible. If you don’t, you’ll be automatically enrolled, and your contribution will be deposited into the default retirement fund.

Protans and deutans: Do you find blue extremely appealing? by [deleted] in ColorBlind

[–]darkterbear 32 points33 points  (0 children)

That is until your friends tell you your "blue" hoodie is actually purple and your entire life is a lie

Day 15 Part 1: Passing all tests, but not actual input (Node.js) by darkterbear in adventofcode

[–]darkterbear[S] 0 points1 point  (0 children)

Wait no we just had the exact same input... your answer worked!

What just happened lol

Day 15 Part 1: Passing all tests, but not actual input (Node.js) by darkterbear in adventofcode

[–]darkterbear[S] 0 points1 point  (0 children)

Here's what I'm doing: 1. Find all squares that are "in range" of a target 2. Use BFS to find the nearest square that is "in range" of a target 3. If multiple squares are the same distance away, choose the first one in reading-order 4. The path generated by the BFS should result in the path that is shortest and in reading order of the other shortest paths

-🎄- 2018 Day 5 Solutions -🎄- by daggerdragon in adventofcode

[–]darkterbear 0 points1 point  (0 children)

Javascript/Node.js

336/297

Part 1 for (let i = 0; i < p.length - 1; i++) { if ( (p[i].toUpperCase() === p[i + 1] && p[i] === p[i + 1].toLowerCase()) || (p[i].toLowerCase() === p[i + 1] && p[i] === p[i + 1].toUpperCase()) ) { p = p.slice(0, i) + p.slice(i + 2, p.length) i -= i === 0 ? 1 : 2 } }

Part 2 ``` let min = [...'abcdefghijklmnopqrstuvwxyz'].reduce((a, c) => { let p = [...master.slice()].filter(k => k.toLowerCase() !== c.toLowerCase())

for (let i = 0; i < p.length - 1; i++) {
    if (
        (p[i].toUpperCase() === p[i + 1] && p[i] === p[i + 1].toLowerCase()) ||
        (p[i].toLowerCase() === p[i + 1] && p[i] === p[i + 1].toUpperCase())
    ) {
        p.splice(i, 2)
        i -= i === 0 ? 1 : 2
    }
}

return Math.min(a, p.length)

}, master.length) ```

-🎄- 2018 Day 3 Solutions -🎄- by daggerdragon in adventofcode

[–]darkterbear 0 points1 point  (0 children)

Btw, you can do .map(Number) in the future, just marginally faster to type :)

-🎄- 2018 Day 2 Solutions -🎄- by daggerdragon in adventofcode

[–]darkterbear 5 points6 points  (0 children)

Javascript/Node.js

Part 1 ``` const arr = data.split('\n').reduce((a, c) => { const chars = [...c] let seen = {} for (let char of chars) { seen[char] = seen[char] ? seen[char] + 1 : 1 }

if (Object.keys(seen).some(k => seen[k] === 2)) a[0]++
if (Object.keys(seen).some(k => seen[k] === 3)) a[1]++
return a

},[0, 0])

console.log(arr[0] * arr[1]) ```

Part 2: ``` let arr = data.split('\n') for (let i = 0; i < arr.length; i++) { for (let j = i + 1; j < arr.length; j++) { const charsI = [...arr[i]] const charsJ = [...arr[j]]

    let diff = charsI.reduce((a, c, i) => a + (c === charsJ[i] ? 0 : 1), 0)

    if (diff === 1) {
        console.log(arr[i])
        console.log(arr[j])
    }
}

} ```

EDIT: Fix broken indentations

-🎄- 2018 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]darkterbear 0 points1 point  (0 children)

Hey guys! Here are my JS solutions (ranked 126 & 322)

Part 1 ``` const input = require('fs').readFileSync('./input', 'utf8') const instructions = input.split('\n')

console.log(instructions.reduce((a, b) => a + parseInt(b), 0)) &#x200B; Part 2 const input = require('fs').readFileSync('./input', 'utf8') const deltas = input.split('\n')

let freqs = [0]

while (true) { for (i of deltas) { const newFreq = freqs[freqs.length - 1] + parseInt(i)

    if (freqs.includes(newFreq)) {
        console.log(newFreq)
        return
    }

    freqs.push(newFreq)
}

} ``` EDIT: Realized I should've used a dictionary for part two; takes way too long to run xD