-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
17/18 ST Q1c #381
Comments
The question didn't state that we are required to complete everything within a single stream pipeline, only criteria is cannot use explicit looping/recursive implementations and data structures. |
hello, this is my attempt.
|
My friends and I found the solution. Here is our working.
|
I don't think this method works when there are 0 elements in the data array. It will return OptionalDouble[0.0] instead of OptionalDouble.empty. If there is only 1 element in the data array, it will give out a OptionalDouble[NaN], which isn't ideal either. I think can use an if statement to catch these corner cases |
thanks all for the help! |
Good catch @Buwoo! We can actually change the last reduce to However, this does not handle the case when there is only 1 element in the data array. We should probably check this before running this code. |
how do i go about doing q1c? im not sure how to store the values of each (Xk - μ)^2 as wont the value require μ to be generated first?
The text was updated successfully, but these errors were encountered: