« first day (2732 days earlier)      last day (2214 days later) » 

11:00 AM
Nothing x = ...; isnt Kotlin
val x: Nothing = ...;
 
Wow, I fixed it.
 
@Wietlol in TypeScript, while never can be used explicitly, it's generally an implicit thing
For example
 
in kotlin, I havent explicitly used it either
 
const x = global.x as (number | string); // explicit cast for the sake of example
if (typeof x === 'string') { return 'foo'; }
if (typeof x === 'number') { return 'bar'; }
const y = x; // at this point, x is of type never for the compiler.

console.log(y); // compile error, console.log doesn't accept never.
 
a void returning function doesnt return Nothing, it returns Unit (which you dont write, and for which you dont need return statements)
the only case you ever use Nothing is as a generic type bound iirc
for example List<out T>::add shouldnt be able to be called
 
11:06 AM
In TypeScript you'd use never to denote a value that is there but is never accessible (either read of write) to you. It's a rare case, but it happens from time to time.
 
11:23 AM
so, I had the technical interview
the team lead and I seemed to really get on
the guy who I had the interview before seemed kinda jelly of that
and kept hinting that they might not hire me because he thinks I have an attitude
 
> the guy who I had the interview before
What does that mean?
 
I had another interview with the guy last friday
2 days ago, by Zirak
@towc shut the fuck up and go to the intreview you shithead
the day this happened
and we really didn't get on well
but he asked me to come for another technical interview on monday
 
Are you really letting personal feelings interact with work environment?
 
it went great, but at some points when they were asking questions, I didn't realize they hadn't finished yet, and I just answered
 
...
 
11:27 AM
good answers, but bad communication, which is probably worse than having meh answers
 
I have to ask: how old are you?
 
@towc you do
 
@paul23 13 and a half
 
@paul23 What do you mean? As an interviewer, it's really important to me that the person I'm intervieweing would be fun to work with, in addition to them being technically apt.
 
we've been trying to tell you this for a while.
 
11:27 AM
@rlemon yeah, I'm realizing how true it is
on the other hand, the attitude is getting me places
 
Places like homelessness
and unemployment
 
I don't try to give other people a bad time, I just try to do what I think is best
 
@MadaraUchiha I've never been hired for "being a nice guy", nor do I ever focus on that. I'm just myself and people have to hire me for what I can do intead of what I am; maybe I'm just lucky but currently the jobs I just get through "hey shouldn't you work with us" questions during hockey/golfing/partying.
 
@Cereal the living in the woods thing is turning out to be pretty cool, actually
 
@toc example ?
 
11:30 AM
Nice programmer interview question( I don't have the answer , nor interested , I just got it from a friend.).
You have an array : `[X1,X2,…,XN]` . Write an algorithm that its result is a sorted array such that a MIN value will occur in `Min(X1*X2+X2*X3+…+Xn-1*Xn)`
 
@RoyiNamir that's a maths interview question
 
My friend got it in a JAVA interview
 
@towc What you think is best, is usually wrong though
 
I don't even understand the question
Can I get like 2 more pages of specs
 
you have an array with numbers in it. you need to write an algorithm that sorts the array such that X1*X2+X2*X3+…+Xn-1*Xn will be a minimum value
 
11:31 AM
@RoyiNamir its nice , interview question suck
 
I don't know the answer. I know that he's a java programmer and he got it. nothing less nothing more
 
Are there any constraints
 
numbers in array >=0
 
Just a stab in the dark, put the biggest one first, then the smallest one second, then the second biggest one last, then the second smallest one second last, then the third biggest one third, etc.
 
This doesn't seem like a programming question, but a math question
 
11:32 AM
@KendallFrey issue with that is that the last ones will be fairly close
 
@Cereal like almost 50% of programming question
 
I think you can avoid that, and reach a better score
 
@towc How is that an issue?
 
@RoyiNamir no
 
@RoyiNamir Lazy programming questions
 
11:33 AM
seems desirable to me
 
Come on I just shared that info. it's not that i agree or not regarding those kind of Q.
 
it is a nice question
imo not so good for interviews as its too math focused
best interview question would be to find a bug in some code or do refactoring or something that you actually do during the job
 
Well that's easy if one considers a simple array like: [1,2,9,10] it is trivial to see that 1*10 + 2*9 is the minimum. So basically you sort the array then take sum(x[i]*x[length-i]). Or if you wish to follow the sorting given: you sort the array from small to largest, then copy it into an array with x[i], x[l-i], x[i+1], x[l-(i+1)] ...
 
Anyone know Docker hub.. i triggered a build but it does nothing
 
@paul23 It's also easy to see that the problem required a sum of three multiplications
 
11:36 AM
Now as for why summation of highest-lowest number is minimal, that is indeed an interesting arithmatic problem.
 
@KendallFrey :-)
 
The correct answer would be 10*1 + 1*2 + 2*9
 
@KendallFrey numbers closest to each other produce the biggest numbers, right? You want the numbers to be as distant as possible
 
I still don't understand =D
 
@KendallFrey Same story holds for same mathimatical quantities: "high-low-high-low" results in lower results than "low-low-high-high"
 
11:38 AM
I'd be terrible in a technical interview
 
@towc I have no idea what you're really saying.
 
and I don't think alternating is the best way to get pairs of numbers of the highest difference
@KendallFrey ok, me neither
it makes sense in my head, like usual
I'll stop now
 
@paul23 only for exponential formulas
 
@paul23 high-low-low-high has even lower results
 
@towc 5*5 is greater than 4*6
 
11:39 AM
@towc No, explain
 
that's what you meant I think
 
@Neil yeah
 
for the same "additive total", bigger multiplication values come from numbers which ---add up-- tend to be about the same
 
@towc it's not simple alternating, it's also placing at different ends of the array
 
@KendallFrey as a rule of thumb, you want the greatest difference between all the numbers that get multiplied, do you agree?
@KendallFrey well, alternating in the context of geometric sequences with negative multipliers, is what I was probably thinking of
 
11:40 AM
@towc Maybe, but I don't think that's a useful rule of thumb. I'd prefer the rule that high numbers get mapped to low numbers as much as possible
 
highest → lowest → next highest → next lowest ...
@KendallFrey it's the same rule
 
I brute forced it :^
 
@KendallFrey That's for the start (and end) because the first/last number is only used once, though algorithmic this is of no importance.
 
@towc no, you still need to put some at the end of the array
 
would still be faster to simply multiply them
 
11:41 AM
@Cereal which lang is that ?
 
@towc oh yeah? prove it
 
On second thought, I think I did that wrong
Let me verify
 
@paul23 How is that "of no importance"? It seems to be the optimal solution
 
@KendallFrey your mapping is one of the ways to get the highest difference between multiplied numbers, do you agree?
it solves it by some metric of "highest difference"
I think there's a better metric of "highest difference" that can be used
 
@towc yes but that's a side effect not a goal
actually I think a slightly higher difference on average could be achieved by a suboptimal algorithm
 
11:43 AM
@KendallFrey it's a subset of a set of algorithms, and it might not be the best algorithm in that set, is what I'm probably saying
 
that is, the one you listed
2 mins ago, by towc
highest → lowest → next highest → next lowest ...
 
@KendallFrey Because the difference become negligible between optimal and suboptimal for large N. It is an "implementation detail" rather than a algorithm.
 
@KendallFrey the average is another metric
 
@paul23 That's not what optimal means, paul
 
@KendallFrey uhm, this is the one you said
alternating
 
11:43 AM
@towc what metric are you using then?
@towc I repeat, no it's not.
 
that's what happens in the geometric sequences with negative multipliers
 
something something not enough jquery
 
ok, let me re-read what your algo was
@KendallFrey I'm trying to think of one
12 mins ago, by Kendall Frey
Just a stab in the dark, put the biggest one first, then the smallest one second, then the second biggest one last, then the second smallest one second last, then the third biggest one third, etc.
that's the same as
1 min ago, by Kendall Frey
2 mins ago, by towc
highest → lowest → next highest → next lowest ...
 
no it's not
 
oh wait
second biggest one last
ok, I misread this
 
11:46 AM
@KendallFrey pendantics.
 
I'm confused
If you're sorting an array
But always adding, how in the world are you going to get a minimum
 
huh?
 
not only adding
 
What's the definition of a minimum value :(
 
also putting some multiplications somewhere
 
11:47 AM
It's not sorting, but just finding an optimal order by another criterion
 
I know
 
@Cereal X1*X2 + X2*X3 + ...
 
@KendallFrey bogo sort?
 
He said "a minimum value", I assume that was the minimum value of an array
but if you have [1,2,3,4], the min is 1
 
11:48 AM
This is where my confusion lies
 
@Cereal f([1,2,9,10]) = 1*2 + 2*9 + 9*10 = 110; f([10,1,2,9]) = 10*1 + 1*2 + 2*9 = 30
 
what if the array has an odd number of elements?
 
The goal is to reorder the array to minimize that sum
 
Oh you're trying to Find the minimum
Oooooooooooooooooohhhhhhhhhh
 
@KendallFrey And what praytell is the difference between sorting and "finding an order by some criterion"?
 
11:48 AM
@Cereal well, just to order the array
 
Yes
 
@Neil I was trying to remove ambiguity about the traditional meaning of sort
 
it is just ordering the array, then create a new array with most outer elements as pairs
 
Which implicitly minimizes 1*X1+2*X2+3*X3...
 
11:49 AM
</conversation>
 
but what if you extend the formula?
you now have [0]*[1] + [1]*[2] + [2]*[3]
but what if you make it to have [0]*[1], [1]*[2], [2]*[3]
 
what do you mean "extend"
 
then you can do the same function again
 
that just looks like the original question?
 
my output shortens the array
making each element the value of [n] * [n+1]
and removing the last element
 
11:51 AM
def fn(arr)
  arr.each_cons(2).inject(0) { |s, (a,b)| s + (a * b) }
end

arr = [1,2,9,10]
p arr.permutation.min { |a, b| fn(a) <=> fn(b) }
 
then you can recurse the function
and then, the way it should be ordered at first might have to be different
 
why are you using recursion ?
 
Brute force ^ =D
 
you only need two loops a sorting algorithm and a loop
 
i think this would be an excellent advent of code thingy
 
11:53 AM
@RoyiNamir It's ruby
 
I can make a test case for y'all if you want to fight
 
seriously I hate pinterest
 
tnx
 
et tu, brute force?
 
im looking for downloadable fonts I dont give a crap about images and inspirational quotes
and 9 out of 10 google results is pinterest
 
11:54 AM
@KamilSolecki fonts.google.com ?
 
Easy test cases: [1, 2, 3, 4, 17, 18, 19, 20] and [1, 2, 3, 4, 10, 17, 18, 19, 20]
 
[19, 2, 17, 4, 3, 18, 1, 20] and [19, 2, 17, 4, 10, 3, 18, 1, 20]
This is really slow lol
 
My test case is gonna be project euler style :P No brute force for you
@Cereal looks like my stab in the dark was right
 
1.547s for the second case
 
11:58 AM
cereal : try to sort it
 
@Cereal wow lol, that's about the same speed one can do by hand
 
I am not a smart person. But kendall gave us all the answer so I guess I could implement that
 
then new array with index [0 , last, 1, last-1, 2, last-2, ....]
@FlorianMargaine my console window was open :P no secrets!
 

« first day (2732 days earlier)      last day (2214 days later) »