Image for post
Image for post

Problem solving is at the core of what Software Engineers do for a living. There may be an array of job titles specifying different types of engineers that deal with software, (e.g, front-end engineer, back-end engineer, dev ops, data-engineer) but ultimately they are tasked with the challenge of solving problems and doing so on a daily basis.

That being said, all problems are not created equal, but they do employ similar strategies for solving them such as accurately evaluating and understanding the problem statement, identifying the provided information, correctly identifying missing information, and crafting solutions that tackle the problem piece by piece in an efficient manner.

Solving algorithm problems can help us improve our general problem solving capabilities and enhance our knowledge of a given programming language. For this series, I will analyze various algorithmic problems from sites like Hacker Rank.


Image for post
Image for post

Every once in a while you have to filter for the truth, thankfully and conveniently JavaScript offers us the every() method which does exactly that.

Method Definition:

It traverses an array instance, applying a callback function to each index with an assigned value, immediately returning false if a value does not pass the conditional within the callback and true if all elements within the traversed array pass.

Method Parameters:

The every() method accepts a required callback function as its first parameter and an optional ‘this’ value as its second.

The callback function accepts the current element, index, and array being…


Image for post
Image for post

Definition:

The Concat() method merges two arrays (e.g, ArrayA, ArrayB) and returns a new array containing the combined members of both ArrayA and ArrayB.

Parameters & Return Value:

The concat() method is invoked on an array instance accepting an N number of values or arrays as arguments.

The return value is a newly merged array containing the initial members of the subject array followed by the parameters passed to concat().

For Example:

const arrayA = [1,2,3,4,5];
const arrayB = [6,7,8,9,10];
// Merging two arrays
const arrayAB = arrayA.concat(arrayB);
// Merging a single array and value
const arrayAndOne = array.concat(1);
//…

Image for post
Image for post

Method Definition:

The filter() method loops over an existing array and applies a callback function to each element, evaluating it against a conditional, if the element is ‘truthy’ then it is returned within a new array.

Method Parameters:

The filter() method accepts a required callback function as its first parameter and an optional ‘this’ value as its second.

The callback function accepts the current element, index, and existing array, as the first, second, and third parameters respectively.

For Example:

function(currentElement, index, array) {} //callback func signature

Method Return Value:

The filter () method returns a new array containing elements that…

Lemuel Uhuru

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store