Show newer

@coriander goblins have better things to than work on esoteric programming problems

I love when you encounter a leetcode problem that is one of the most challenging problems you have ever seen in your life and you look up the solution and it is the most brilliant thing you've ever seen, and website only lists the problem as medium difficulty

@vaporeon_ I tried rewriting it with let and const and there was no real impact on the speed

@vaporeon_ I don't know Go. I said I would probably like it, but that is a gut instinct based on, like, reading Wikipedia. I've never actually used it at all.

If I ever learn Go I will happily share horrendous code I make with it to :vaporeon:

@vaporeon_ Array is the ordinary JavaScript array. using the constructor is abnormal but I know the exact size of the array so it is (probably) slightly more efficient to use the constructor so I can initialize it to an exact size.

in my experience var runs faster than let/const and its goofy scoping rules let me make the code more golfy. (I declare m in the first for loop and the return statement uses m! its terrible and i love it!!!!!!)

@vaporeon_ it is 100x slower than the optimal solution and it is Worth It

@vaporeon_ look at this beauty:

var change = function(amount, coins) {
for (var i = 0, m = new Array(coins.length); i < coins.length; ++i) m[i] = new Array(amount + 1).fill(0), m[i][0] = 1;

for (var r = coins.length - 1; r >= 0; --r) for (var c = 1; c <= amount; ++c) for (x = r; x < coins.length; ++x) if (c - coins[x] >= 0) m[r][c] += m[x][c - coins[x]];

return m[0][amount];
};

@vaporeon_ @aescling explain to me why we don't have the confused psyduck emojo

@vaporeon_ C++'s type system, since it always make me feel like :psyduck:

@lapis that one made me giggle uncontrollably when I added it to the poll

@vaporeon_ According to the standard, every expression belongs to exactly one of the fundamental classifications lvalue, xvalue, or prvalue.

A prvalue is an expression that 1) when evaluated, initializes an object, or 2) computes the value of an operand of an operator, as specified by the context in which it appears, or 3) has type cv void.

An expression is an xvalue if it is 1) a move-eligible id-expression, 2) the result of calling a function, implicitly or explicitly, whose return type is an rvalue reference to object type, 3) a cast to an rvalue reference to object type, 4) a subscripting operation with an xvalue array operand, 5) a class member access expression designating a non-static data member of non-reference type in which the object expression is an xvalue, or 6) a .* pointer-to-member expression in which the first operand is an xvalue and the second operand is a pointer to data member.

An expression is an lvalue if it satisfies both of the following conditions: 1) it is not an xvalue, and 2) its evaluation determines the identity of an object or function.

I don't think there is a human being on the planet who understands every detail of these definitions.

How do you wear a backpack as an adult

Show older
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.