Skip to content

Instantly share code, notes, and snippets.

View codaboba's full-sized avatar

Phan Le codaboba

  • Chicago, IL
View GitHub Profile

Study Saturdays - React

React + JSX

React doesn't require JSX but it's makes writing web apps tremendously easier. It also allows React to show more useful error and warning messages.

React.createElement(component, props, ...children) is equivalent to <Element prop={prop}><Child /></Element>

Ways to handle events

Prompt

Given an an array of numbers, find the length of the longest possible subsequence that is increasing. This subsequence can "jump" over numbers in the array. For example in [3, 10, 4, 5] the longest increasing subsequence (LIS) is [3, 4, 5].

Examples

longestIncreasingSubsequence([3, 4, 2, 1, 10, 6]);
// should return 3, the length of the longest increasing subsequence:
// 3, 4, 6 (or 3, 4, 10)

Dictionary Word Finder

Interviewer Prompt

Given an alphabetical array of dictionary entries and a word to search for, find that word's definition (if it exists). A dictionary entry is just a string where the word's name appears first, followed by - [definition].

const dictionary = [
  'a - Used when mentioning someone or something for the first time in a text or conversation',

Clock Minute Adder


Interviewer Prompt

Given:

  • a time in string format HH:MM
  • a number of minutes

class: center, middle

Intersection


Prompt

Given two sorted arrays of numbers, return an array containing all values that appear in both arrays. The numbers in the resulting array (the "intersection") may be returned in any order, they needn't be sorted.