Skip to content
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

solution1.6.2.3 added #50

Merged
merged 7 commits into from
Jan 9, 2024
Merged

solution1.6.2.3 added #50

merged 7 commits into from
Jan 9, 2024

Conversation

andreas-roehler
Copy link
Contributor

No description provided.

Signed-off-by: Andreas Roehler <[email protected]>
Signed-off-by: Andreas Roehler <[email protected]>
Signed-off-by: Andreas Roehler <[email protected]>
(1 to 1000).toList.filter(x => f(x))
}

nestedIs3Factor(is3Factor)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have two comments here:

  1. Please add an assert to verify that the result is correct.

  2. The function nestedIs3Factor could do .filter().toList instead of .toList.filter() because filtering will probably leave fewer results, so it's less memory.

Signed-off-by: Andreas Roehler <[email protected]>
Signed-off-by: Andreas Roehler <[email protected]>
Signed-off-by: Andreas Roehler <[email protected]>
def normalize(a: List[Double]): List[Double] = {

val b = a.map(k => k.abs).max
if (b == 0) a else a.map(_ / 4)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded division by 4 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Signed-off-by: Andreas Roehler <[email protected]>
@winitzki winitzki merged commit 4649f98 into winitzki:master Jan 9, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants