Remove duplicates from an array in JavaScript
Given an array containing items (numbers and strings), remove all the duplicates.
Given an array containing items (numbers and strings), remove all the duplicates.
In this post we will explore all the ways we can iterate through an array in JavaScript. Letβs loop! π Standard ways Other ways – here the goal is to not iterate but get results from array data Different ways to iterate a JS array Other ways to process array… Read More »10 Ways to iterate through an array in JavaScript
πLC3024 π’ Easy π§© Pattern β Array, math logic You are given a 0-indexed integer array nums of size 3 which can form the sides of a triangle. Return a string representing the type of triangle that can be formed or “none” if it cannot form a triangle. Example Solution… Read More »Type of Triangle – 3024
πLC1 π’ Easy π§© Pattern β Hashtable and Array Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element… Read More »Two Sum – LC1 JS Solution
πLC150 π‘ Medium π§© Pattern β Stack You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation. Evaluate the expression. Return an integer that represents the value of the expression. Note that: Example Solution We use a stack to keep track of… Read More »Evaluate Reverse Polish Notation – 150
Transpose or swap the rows and columns of the given matrix – 2D array in JavaScript. Matrix swapping takes place diagonally. π’ Easy π§© Pattern β Arrays Example JS code to transpose a square matrix Since a square matrix has the same number of rows and columns, we only need… Read More »Transpose a Matrix – JavaScript