Commit Graph

5 Commits (3115588b8f1ab3fa6397159791590638f5c707ac)

Author SHA1 Message Date
Gregory Gubarev 47bff1626b Javascript: add solution to hint Match Characters that Occur Zero or … (#19231) 2018-10-21 15:56:48 +09:00
Bouncey 6d511c558a fix(guide): Fix all frontmatter 2018-10-19 16:28:34 +01:00
Bill Sourour f0eb384b10 Smallest Common Multiple – Optimized Advanced Solution (#19572)
* Optimized advanced solution

Made 2 minor improvement to the advanced solution:

1. The original advanced solution used `Math.max` and `Math.min` against the supplied array, this causes the values in the supplied array to be compared twice. If we use sort instead, the values are only compared once and we can target the max and min values using an index. This is more efficient.

2. The original solution caused `lcm(min, min + 1)` to be evaluated twice. By incrementing `min` the first time we run `lcm` we avoid this duplication and also by taking advantage of the prefix increment operator ++ in the while loop, we trim a line.

* Fixed extra spaces in code block

* Incorporated code feedback from #19572

Made the following changes to the advanced code solution:

- Converted helper functions to arrow function constants
- Simplified comments
- Used destructuring and `sort` for `min` and `max`

* Fixed spacing.
2018-10-18 10:08:45 -07:00
Adrian Skar a01cc367e0 [Guide] Basic JS: Random numbers within range. Enhancements (#19539)
* [Guide] Basic JS: Random numbers within range. Enhancements

Added code solution, explanation, resources and other minor fixes.

* Additional fix; list.

* update: created ordered list of calculation
2018-10-17 09:31:27 -07:00
Mrugesh Mohapatra da0df12ab7 fix(guide): simplify directory structure 2018-10-16 21:32:40 +05:30