How to solve whiteboard interview questions
- Readable
- Time Complexity
- Space Complexity
import { mockClient } from 'aws-sdk-client-mock' | |
import { PutItemCommand, GetItemCommand, QueryCommand, DeleteItemCommand } from '@aws-sdk/client-dynamodb' | |
import { marshall } from '@aws-sdk/util-dynamodb' | |
import * as dynamoose from 'dynamoose' | |
export type Item = Record<string, string | boolean | number> | |
export interface IMockDynamooseOptions { | |
item?: Item, | |
rejects?: boolean |
{ | |
"Resources": { | |
"ecommerceapprdsdbcredentialsdevelopment0F585BD5": { | |
"Type": "AWS::SecretsManager::Secret", | |
"Properties": { | |
"GenerateSecretString": { | |
"GenerateStringKey": "password", | |
"SecretStringTemplate": "{\"username\":\"username\"}" | |
}, | |
"Name": "ecommerce-app-rds-db-credentials-development" |
body { | |
white-space: pre; | |
font-family: consolas; | |
color: white; | |
background: #011627; | |
font-size: 12px; | |
} | |
.property { | |
color: #7fdbca; |
// Google Interview Video: https://www.youtube.com/watch?v=XKu_SEDAykw | |
// Provided an array of numbers, | |
// find a pair of numbers that add up | |
// to a provided sum | |
// O(n) linear time complexity | |
const hasPairWithSum = (arr, sum) => { | |
const set = new Set(); // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set | |
const len = arr.length; // Setting the arr.length to a variable here will prevent creating the variable for every iteration in the array | |
for (let i = 0; i < len; i++) { |
[![Netlify Status][netlify-shield]][netlify-url] [![Contributors][contributors-shield]][contributors-url] [![HitCount][hitcount-shield]][hitcount-url] [![Language grade: JavaScript][lgtm-shield]][lgtm-url] [![FOSSA Status][fossa-shield]][fossa-url] [![David Dependencies Status][dependencies-shield]][dependencies-url] [![License: MIT][license-shield]][license-url] [![LinkedIn][linkedin-shield]][linkedin-url] [![Twitter: HoukasaurusRex][twitter-shield]][twitter-url]
## | |
# Host Database | |
# | |
# localhost is used to configure the loopback interface | |
# when the system is booting. Do not change this entry. | |
## | |
127.0.0.1 localhost | |
255.255.255.255 broadcasthost | |
::1 localhost |
// Original: https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/ | |
// Usage | |
// 1. Enter sheet name where data is to be written below | |
var sheetName = 'Users' | |
// 2. Run > setup | |
// | |
// 3. Publish > Deploy as web app | |
// - enter Project Version name and click 'Save New Version' | |
// - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously) |