HugoLnx / HugoLnx/igor-exercises
Week 1 comments
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
# Talk about space complexity
https://github.com/HugoLnx/igor-exercises/blob/7f487c30a1d9a4731c5ffbf279b693be5ed7e41d/week1/fibonnaci.js#L52
# Talk about memoization
https://github.com/HugoLnx/igor-exercises/blob/7f487c30a1d9a4731c5ffbf279b693be5ed7e41d/week1/fibonnaci.js#L59
# Talk about code simplicity
Sample
```ruby
def max_repetition(r1, r2)
if r1[:repetitions] > r2[:repetitions] || (r1[:repetitions] == r2[:repetitions] && r1[:number] > r2[:number])
r1
else
r2
end
end
def most_repeated(array)
if array.empty?
return {number: nil, repetitions: nil}
end
current = {number: array[0], repetitions: 1}
max = current
array[1..-1].each do |number|
if current[:number] == number
current[:repetitions] += 1
else
max = max_repetition(current, max)
current = {number: number, repetitions: 1}
end
end
max_repetition(current, max)
end
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.