This repository was archived by the owner on Jun 7, 2019. It is now read-only.
Open
Conversation
iaguirre88
reviewed
Feb 11, 2019
|
|
||
| ## The problem | ||
|
|
||
| Let's say we need to implement a function that receives a list of integers and returns a list including those numbers repeated several times, as it is showed in the following examples: |
Member
There was a problem hiding this comment.
Maybe I would replace the several times with the more specific description below the example to make it clearer (and remove the second description of the problem)
|
|
||
| ## Our first naive implementation | ||
|
|
||
| We could say that a very simple solution to this problem could be an approach where we use `Enum.reduce/3` and repeat each number, concatenating the list of repeated values to the accumulated list. |
Member
There was a problem hiding this comment.
This sentence feels a little repetitive to me because of the many could.
Maybe something like this might sound better (not really sure n_n")
A very simple solution to this problem could be using `Enum.reduce/3` and repeat each number ...
|
|
||
| In my machine this is running **in approximately 11ms**! It is a huge difference, and this is proportional to the length of the list we are testing. | ||
|
|
||
| All good so far, but... are we sure that this is going to perform better in all cases? Well, we're not in a safe place yet. Let's run again our function using a different input. |
Member
There was a problem hiding this comment.
Let's run our function again using a different input.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.