Skip to content

Instantly share code, notes, and snippets.

@pawanbenjamin
pawanbenjamin / multiDimSum.md
Created June 26, 2023 12:47 — forked from jluria/multiDimSum.md
A multi dimensional array sum solution

Prompt

Given an array of numbers, including nested arrays of numbers, write a function which returns the sum of all the numbers in the array and nested arrays.

Example

multiDimSumArray([1,4,[4,2],[2,[1,3]],3]) // should return 20

Follow-up example:

Puppy Bowl Step By Step

These steps should be followed after you initialize your React Project

1. Create your file structure

├── src
│   ├── App.jsx
│ ├── API

How to add a React Application to your Express App

Step 1

In the root of your Project, run npx create-react-app client

  • This will create a react project in your exisitng project (with its own package.json and node_modules)
  • This will be where your entire front end will live!

Step 2 Add a Proxy in your Client folder

Glossary of Important Terms

My notes from systems expert


Client

  • A machine or process that sends a request to a server

Server

  • A machine or process that provides data for a client
@pawanbenjamin
pawanbenjamin / README.md
Created December 13, 2021 16:57 — forked from paulmelero/README.md
DeepClone-js: JS utility with circular replacer

DeepClone-js

Utility to clean up circular references while creating a new reference of an object performing a deep copy (as oposite to a shallow copy). Bear in mind it doesn't work with some data types: Date, Map, RegExp, Set, TypedArray...

📦 Install

npm i -S gist:0bce1161cfd2aa91ae7cad9abb42c342

class: center middle

Reverse a Linked List


Interviewer Prompt

const mkNode = (value, next = null) => ({ value, next })
const nums = mkNode(1, mkNode(2, mkNode(3)))

The People's Smoothie

Create a class Smoothie and do the following:

MDN DOCUMENTATION FOR CLASSES: HERE

  • Create a constructor property called ingredients.
  • Create a getCost method which calculates the total cost of the ingredients used to make the smoothie.
  • Create a getPrice method which returns the number from getCost plus the number from getCost multiplied by 1.5. Round to two decimal places.
  • Create a getName method which gets the ingredients and puts them in alphabetical order into a nice descriptive sentence. If there are multiple ingredients, add the word "Fusion" to the end but otherwise, add "Smoothie". Remember to change "-berries" to "-berry". See the examples below.

Palindrome Check

Learning Objective

  • Analyze and compare recursive and iterative approaches

Interviewer Prompt

Given an string str, create a function that returns a boolean, corresponding to whether that string is a palindrome (spelled the same backwards and forwards). Our palindrome check should be case-insensitive.