Skip to content

Instantly share code, notes, and snippets.

def validCoords?(coord_strings)
coords = parseCoords(coords) # take ["a1", "b3"] => [["b", 3], ["a", 1]]
if coords.length == 0
return false
start_a = coords[0][0]
start_b = coords[0][1]
if increasingNumbers?(coords[0], coords[1])
const delay = (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
}
const getExpandButtons = () => {
return Array.from(document.querySelectorAll("[title='Expand Down']")).concat(Array.from(document.querySelectorAll("[title='Expand All']")))
}
const expandAll = async () => {
let expand_buttons = getExpandButtons();
fdka;sdfjsadf
/* System Uptime monitor:
A system is made of multiple different components. When one goes down, the entire system is down.
Given intervals of component downtimes, return the intervals during which the system was operational.
Hours are marked in military time 0-23.
input: []
Output: [[0,23]]
// Find the first string in a list that is unique
// ['abc', 'd', 'j', 'abc', 'j'] => 'd'
// time complexity O(n^2) and space complexity is constant O(1)
const bruteForceSolution = strings => {
const n = strings.length;
for (let i = 0; i < n && !result; i++) {
// ==Question==
// Given a sequence of integers and an integer total target, return whether a contiguous sequence of integers sums up to target.
// ===Example===
// [1, 3, 1, 4, 23], 8 : True (because 3 + 1 + 4 = 8)
// [1, 3, 1, 4, 23], 7 : False
// total = 9
const concat = (...elements) => elements.reduce((acc, el) => el ? acc.concat(el) : acc, []);
const getPowerWord = power => ['', 'Thousand', 'Million', 'Billion'][power];
const getTens = tens => ['Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninetey'][tens - 2]
const below20 = num => ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eightteen', 'Nineteen'][num]
const below100 = num => num < 20 ? [below20(num)] : concat([getTens(Math.floor(num / 10)), below20(num % 10)]);
const hundrify = num => Math.floor(num / 100) ? [below20(Math.floor(num / 100)), 'Hundred'] : '';
const below1000 = num => concat(hundrify(num), below100(num % 100));
const powerify = (num, power) => num ? concat(below1000(num), getPowerWord(power)).join(' ') : [];
const solution = (integer) => {
// (224) 577 5898
const getTens = tens => ['Ten', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninetey'][tens - 1]
const below20 = integer => ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eightteen', 'Nineteen'][integer - 1]
const addWords = (result, words) => result.length === 0 ? words : `${result} ${words}`;
const solution = (integer) => {
if (integer === 0) return 'Zero';
# frozen_string_literal: true
class AvailabilitiesController < AuthenticatedController
before_action :authenticate_interviewer!
def index
respond_to do |format|
format.json do
render json: Availability.where(interviewer: @interviewer)
end
Task Time required Assigned to Current Status Finished
Calendar Cache > 5 hours in progress - [x] ok?
Object Cache > 5 hours in progress [x] item1
[ ] item2
Object Cache > 5 hours in progress
  • item1
  • item2
Object Cache > 5 hours in progress
  • item1
  • item2
  • works
  • works too