Array Manipulations
15 JavaScript array manipulations challenges, each with test cases you can run in the browser.
- findMax — Easy. Given an array of numbers, return the largest number.
- rotateLeft — Easy. Given an array of ints, return an array with the elements 'rotated left' so [1, 2, 3] yields [2, 3, 1].
- chunkArrayInGroups — Easy. Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a two-dimensiona
- falsyBouncer — Easy. Remove all falsy values from an array. Falsy values in JavaScript are false, null, 0, '', undefined, and NaN.
- diffArray — Medium. Compare two arrays and return a new array with any items only found in one of the two given arrays, but not both. In other words, return the
- uniteUnique — Medium. Write a function that takes two or more arrays and returns a new array of unique values in the order of the original provided arrays.
- steamrollArray — Medium. Flatten a nested array. You must account for varying levels of nesting.
- chunk — Medium. Given an array and chunk size, divide the array into many subarrays where each subarray is of length size.
- spiralMatrix — Medium. Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
- pairwise — Hard. Given an array arr, find element pairs whose sum equal the second argument arg and return the sum of their indices. If multiple pairs are po
- bubbleSort — Hard. Implement the bubble sort algorithm to sort an array of numbers in ascending order.
- selectionSort — Hard. Implement the selection sort algorithm to sort an array of numbers in ascending order.
- insertionSort — Hard. Implement the insertion sort algorithm to sort an array of numbers in ascending order.
- trappingRainWater — Hard. Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raini
- medianOfTwoSortedArrays — Hard. Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time compl