Skip to content

Instantly share code, notes, and snippets.

View stashayancho's full-sized avatar

Stasha Yancho stashayancho

View GitHub Profile
@stashayancho
stashayancho / sparkle.js
Created May 29, 2019 19:23
Sparkle CSS animation with only in-line styling in React
const Sparkle = props => {
const style = {
animation: `${props.duration} linear ${props.delay} infinite sparkle`,
backgroundColor: 'GhostWhite',
borderRadius: '50%',
boxShadow: `0 0 ${props.blur} ${props.spread} rgba(255, 255, 224, 0.5)`,
height: props.height,
left: props.left,
position: 'relative',
top: props.top,

Decimal-To-Binary & reverse


Prompt

Write 2 functions, one that takes the a number in base 10 (decimal) and converts it to the string representation of that number in base 2 (binary), and one that converts back.

You may not use parseInt, toString, or any similar function which does base conversion for you.

Priority Queue


Definitions

A queue is a data structure that stores pieces of data and returns them in the same order in which they were inserted. One way of implementing them is as a linked list.

A priority queue is a data structure that takes a priority value with each piece of data and returns the data in order of priority.

Slides


Prompt

You're an industrious programmer that lives off the grid. The local well that you use to fetch water has gone dry, so you've decided to collect rain water to filter; however, your collection device isn't flat.

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water your collection device is able to trap after raining.

Prefix Search


Prompt

Given a "book" and a string to search for, return an array of the character indices for every word in the book that begins with that string.

The book will contain two things: a book id and a string of English text. The search should be case insensitive.