Ad
Algorithms

Given 2 values, using a single line of code swap their values and return an array of the swapped values.

Tasks

  • Optimize the current solution
  • Write more robust tests
  • Write a more robust description

Example Starting Setup

// This code is intentionally written without {} so your solution is only a single line
const swapValues = (a, b) => (/* your code here */);
// This code is intentionally written without {} so your solution is only a single line
const swapValues = (a, b) => ([a, b] = [b, a]);
Algorithms

Given 2 whole numbers (low & high), write a function to find all whole numbers between the given values as an array. Return that array in reverse order.

Tasks

  • Optimize the current solution
  • Create a solution that makes the EXTRA TESTS pass (string inputs, high to low)
  • Write more robust tests
  • Write a more robust description

Example Starting Setup

const reverseOrder = (low, high) => {
  // your code here
};
const reverseOrder = (low, high) => {
  let reverseArray = [];

  for (let i = high; i > low - 1; i--) {
    reverseArray.push(i);
  }

  return reverseArray;
};
Code
Diff
  • //  def multiply (a,b):
    //      return a * b
    
    const multiply = (a, b) => a * b;
    
    • // # def multiply (a,b):
    • // # return a * b
    • // def multiply (a,b):
    • // return a * b
    • multiply = (a, b) => a * b;
    • const multiply = (a, b) => a * b;

Checks for binary truthy and falsey parameters