Oh yeah, I misspoke, gonna edit.
hmm, my code keeps getting truncated at for y in ..
, anyone have any idea why? Maybe the "<" right after that confuses a parser somewhere?
Did this in Odin
Here's a tip: if you are using a language / standard library that doesn't have a set, you can mimic it with a map from your key to a nullary (in this case an empty struct)
package day3
import "core:fmt"
import "core:strings"
import "core:unicode"
import "core:strconv"
flood_get_num :: proc(s: string, i: int) -> (parsed: int, pos: int) {
if !unicode.is_digit(rune(s[i])) do return -99999, -1
pos = strings.last_index_proc(s[:i+1], proc(r:rune)->bool{return !unicode.is_digit(r)})
pos += 1
ok: bool
parsed, ok = strconv.parse_int(s[pos:])
return parsed, pos
}
p1 :: proc(input: []string) {
// wow what a gnarly type
foundNumSet := make(map[[2]int]struct{})
defer delete(foundNumSet)
total := 0
for y in 0..
Huh. When I took Calculus II in community college, the professor introduced sum notation and like 2/3 of the class was like "wow that's cool I didn't know about that". I don't remember ever being formally taught it before that but it still surprises be how few people where already familiar with it.
One of the reasons I really disliked Reddit and stopped using it years ago was this way of using the voting system. If I make a post, and it gets voted something like +4-10, and a reply that is some rewording of "that's a dumb statement", what am I to think? I'm certainly not going to change my mind, no one gave me a good reason to.
If one is voting because they feel they can’t stand behind their opinion if they expanded it in text… I don’t know what to tell ya.
I'm inclined to believe a lot of people do this. This is not to say they are terrible for doing this, it's that it's human nature. Replying to someone with a well thought out post takes effort and, from my experience, makes the me realize i don't know shit about the subject. Point is, this way of using the voting system breeds half-thought opinions which is a host of a lot of other problems.
The thing that finally got businesses to finally get off IE wasn't from the browser being worse than every other option. Heck, it wasn't even because it was a decrepit piece of software that lost it's former market dominance (and if anything businesses see that as a positive, not a negative).
What finally did that was microsoft saying there won't be any security updates. That's what finally got them off their ass; subtly threatening them with data breaches, exploits, etc. if they continue to use it. I don't see google doing this anytime soon, at least not without a "sequel" like microsoft had with edge.