{{ message }}

Instantly share code, notes, and snippets.

# Damilare Obayanju Obayanju

Last active Feb 24, 2021 — forked from krishnadey30/LeetCodeQuestions.md
Curated List of Top 75 LeetCode
Last active Feb 16, 2021
Useful for getting input in competitive programming questions.
View input-template.py
 def getInt(): return int(input()) def getListOfInts(): return list(map(int, input().split(' '))) def main(): t = getInt() main()
Last active Feb 9, 2021
View product-list.py
 # Space comp = O(n) where n = number of numbers class ProductList: def __init__(self): self.prefixProd = [] # Time Comp = O(1) def add(self, n): prefixProd = self.prefixProd if n == 0: self.prefixProd = []
Last active Feb 2, 2021
View stocks.py
 ''' You are given a snapshot of a queue of stocks that have changing prices coming in from a stream. Remove the outdated stocks from the queue. Example: \$ snapshot = [ { sym: ‘GME’, cost: 280 }, { sym: ‘PYPL’, cost: 234 }, { sym: ‘AMZN’, cost: 3206 }, { sym: ‘AMZN’, cost: 3213 }, { sym: ‘GME’, cost: 325 }
Created Jun 2, 2020
View test-dollar-change.py
 def count_bills(bills, amount): result = 0 bills.reverse() for bill in bills: result += amount//bill amount %= bill return result def count_bills2(bills, amount): dp = [0] + [float('inf')]*amount
Created Apr 26, 2020
View bananas.py
 ''' Koko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. The guards have gone and will come back in H hours. Koko can decide her bananas-per-hour eating speed of K. Each hour, she chooses some pile of bananas, and eats K bananas from that pile. If the pile has less than K bananas, she eats all of them instead, and won't eat any more bananas during this hour. Koko likes to eat slowly, but still wants to finish eating all the bananas before the guards come back. Return the minimum integer K such that she can eat all the bananas within H hours. https://leetcode.com/problems/koko-eating-bananas/
Created Feb 7, 2019 — forked from TSiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat Sheet.md

## Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

## Data Structure Basics

###Array ####Definition:

• Stores data elements based on an sequential, most commonly 0 based, index.
• Based on tuples from set theory.
Last active Aug 13, 2018
View constructor-confusion-2.js
 function Planet() { // .... } // create a new prototype object Planet.prototype = {/* .. */}; let mars = new Planet(); mars.constructor === Planet; // false mars.constructor === Object; // true
Last active Aug 13, 2018
View constructor-confusion.js
 function Planet() { // .... } Planet.prototype.constructor === Planet; // true let mars = new Planet(); mars.constructor === Planet; // true
Last active Aug 13, 2018
View class-mimic.js
 function Planet() { // .... } let mars = new Planet();