Isn't my "basic solution" "better/easier"? - Chunky Monkey

Exercise page: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey/

Get a hint page: https://guide.freecodecamp.org/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey/

Isn’t my solution simpler than the “basic solution”? Could I theoretically replace my solution with the current “basic solution”? See the current “basic solution” in the image below.

Actually, I would consider your solution not as basic as the current solution. Why? Because you combine several steps into one which makes it not as readable. Conciseness does not always equivocate to being readable. Readability is more about having variable names which clearly convey what the variables represent and function names which convey “what” the functions do.

Keep in mind that one person’s “Easy” is another person’s “Advanced”. I would not get too caught up in determining if a solution is “Easy”, “Intermediate”, or “Advanced”. These are highly subjective ratings and I wish they were never setup in the Guides like this.

Originally, “Advanced” was more about code which used newer syntax (i.e. ES6 when it was new), but over time it changed depending on who was reviewing/approving the suggestions for the solutions. We are considering removing all such verbiage from the Guide solutions and possibly moving to describing solutions in terms of Time Complexity and Space Complexity which are much more objective ways of rating code.

2 Likes

Thanks again RandellDawson. I understand better now.