working on it ...

# Explore Public Snippets

Found 6,747
snippets
matching: *interview*

class Interval: def __init__(self, s=0, e=0): self.start = s self.end = e class Solution: def insert(self, intervals, newIntervals): """ Inserts the new interval into the list and returns merged intervals. 1. Appends the new interval to the list. 2. Sorts the list. 3. Iterates through and merges the new interval list. """ if not intervals: return [newInterval] intervals.append(newInterval) intervals.sort(lambda x, y: x.start - y.start) result = [] length = len(intervals) last = intervals[0] for i in range(1, length): current = intervals[i] if current.start <= last.end: # Merge intercetions last.end = max(last.end, current.end) else: result.append(last) last = current result.append(last) return result

####
public
by TSiege
*1526*
*1*
*4*
*0*

### 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.

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.:
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](https://gist.github.com/TSiege/cbb0507082bb18ff7e4b) 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](http://en.wikipedia.org/wiki/Tuple) from set theory. - They are one of the oldest, most commonly used data structures. ####What you need to know: - Optimal for indexing; bad at searching, inserting, and deleting (except at the end). - **Linear arrays**, or one dimensional arrays, are the most basic. - Are static in size, meaning that they are declared with a fixed size. - **Dynamic arrays** are like one dimensional arrays, but have reserved space for additional elements. - If a dynamic array is full, it copies it's contents to a larger array. - **Two dimensional arrays** have x and y indices like a grid or nested arrays. ####Big O efficiency: - Indexing: Linear array: O(1), Dynamic array: O(1) - Search: Linear array: O(n), Dynamic array: O(n) - Optimized Search: Linear array: O(log n), Dynamic array: O(log n) - Insertion: Linear array: n/a Dynamic array: O(n) ###**Linked List** ####Definition: - Stores data with **nodes** that point to other nodes. - Nodes, at its most basic it has one datum and one reference (another node). - A linked list _chains_ nodes together by pointing one node's reference towards another node. ####What you need to know: - Designed to optimize insertion and deletion, slow at indexing and searching. - **Doubly linked list** has nodes that reference the previous node. - **Circularly linked list** is simple linked list whose **tail**, the last node, references the **head**, the first node. - **Stack**, commonly implemented with linked lists but can be made from arrays too. - Stacks are **last in, first out** (LIFO) data structures. - Made with a linked list by having the head be the only place for insertion and removal. - **Queues**, too can be implemented with a linked list or an array. - Queues are a **first in, first out** (FIFO) data structure. - Made with a doubly linked list that only removes from head and adds to tail. ####Big O efficiency: - Indexing: Linked Lists: O(n) - Search: Linked Lists: O(n) - Optimized Search: Linked Lists: O(n) - Insertion: Linked Lists: O(1) ###**Hash Table or Hash Map** ####Definition: - Stores data with key value pairs. - **Hash functions** accept a key and return an output unique only to that specific key. - This is known as **hashing**, which is the concept that an input and an output have a one-to-one correspondence to map information. - Hash functions return a unique address in memory for that data. ####What you need to know: - Designed to optimize searching, insertion, and deletion. - **Hash collisions** are when a hash function returns the same output for two distinct outputs. - All hash functions have this problem. - This is often accommodated for by having the hash tables be very large. - Hashes are important for associative arrays and database indexing. ####Big O efficiency: - Indexing: Hash Tables: O(1) - Search: Hash Tables: O(1) - Insertion: Hash Tables: O(1) ###**Binary Tree** ####Definition: - Is a tree like data structure where every node has at most two children. - There is one left and right child node. ####What you need to know: - Designed to optimize searching and sorting. - A **degenerate tree** is an unbalanced tree, which if entirely one-sided is a essentially a linked list. - They are comparably simple to implement than other data structures. - Used to make **binary search trees**. - A binary tree that uses comparable keys to assign which direction a child is. - Left child has a key smaller than it's parent node. - Right child has a key greater than it's parent node. - There can be no duplicate node. - Because of the above it is more likely to be used as a data structure than a binary tree. ####Big O efficiency: - Indexing: Binary Search Tree: O(log n) - Search: Binary Search Tree: O(log n) - Insertion: Binary Search Tree: O(log n) ## Search Basics ###**Breadth First Search** ####Definition: - An algorithm that searches a tree (or graph) by searching levels of the tree first, starting at the root. - It finds every node on the same level, most often moving left to right. - While doing this it tracks the children nodes of the nodes on the current level. - When finished examining a level it moves to the left most node on the next level. - The bottom-right most node is evaluated last (the node that is deepest and is farthest right of it's level). ####What you need to know: - Optimal for searching a tree that is wider than it is deep. - Uses a queue to store information about the tree while it traverses a tree. - Because it uses a queue it is more memory intensive than **depth first search**. - The queue uses more memory because it needs to stores pointers ####Big O efficiency: - Search: Breadth First Search: O(|E| + |V|) - E is number of edges - V is number of vertices ###**Depth First Search** ####Definition: - An algorithm that searches a tree (or graph) by searching depth of the tree first, starting at the root. - It traverses left down a tree until it cannot go further. - Once it reaches the end of a branch it traverses back up trying the right child of nodes on that branch, and if possible left from the right children. - When finished examining a branch it moves to the node right of the root then tries to go left on all it's children until it reaches the bottom. - The right most node is evaluated last (the node that is right of all it's ancestors). ####What you need to know: - Optimal for searching a tree that is deeper than it is wide. - Uses a stack to push nodes onto. - Because a stack is LIFO it does not need to keep track of the nodes pointers and is therefore less memory intensive than breadth first search. - Once it cannot go further left it begins evaluating the stack. ####Big O efficiency: - Search: Depth First Search: O(|E| + |V|) - E is number of edges - V is number of vertices ####Breadth First Search Vs. Depth First Search - The simple answer to this question is that it depends on the size and shape of the tree. - For wide, shallow trees use Breadth First Search - For deep, narrow trees use Depth First Search ####Nuances: - Because BFS uses queues to store information about the nodes and its children, it could use more memory than is available on your computer. (But you probably won't have to worry about this.) - If using a DFS on a tree that is very deep you might go unnecessarily deep in the search. See [xkcd](http://xkcd.com/761/) for more information. - Breadth First Search tends to be a looping algorithm. - Depth First Search tends to be a recursive algorithm. ## Efficient Sorting Basics ###**Merge Sort** ####Definition: - A comparison based sorting algorithm - Divides entire dataset into groups of at most two. - Compares each number one at a time, moving the smallest number to left of the pair. - Once all pairs sorted it then compares left most elements of the two leftmost pairs creating a sorted group of four with the smallest numbers on the left and the largest ones on the right. - This process is repeated until there is only one set. ####What you need to know: - This is one of the most basic sorting algorithms. - Know that it divides all the data into as small possible sets then compares them. ####Big O efficiency: - Best Case Sort: Merge Sort: O(n) - Average Case Sort: Merge Sort: O(n log n) - Worst Case Sort: Merge Sort: O(n log n) ###**Quicksort** ####Definition: - A comparison based sorting algorithm - Divides entire dataset in half by selecting the average element and putting all smaller elements to the left of the average. - It repeats this process on the left side until it is comparing only two elements at which point the left side is sorted. - When the left side is finished sorting it performs the same operation on the right side. - Computer architecture favors the quicksort process. ####What you need to know: - While it has the same Big O as (or worse in some cases) many other sorting algorithms it is often faster in practice than many other sorting algorithms, such as merge sort. - Know that it halves the data set by the average continuously until all the information is sorted. ####Big O efficiency: - Best Case Sort: Merge Sort: O(n) - Average Case Sort: Merge Sort: O(n log n) - Worst Case Sort: Merge Sort: O(n^2) ###**Bubble Sort** ####Definition: - A comparison based sorting algorithm - It iterates left to right comparing every couplet, moving the smaller element to the left. - It repeats this process until it no longer moves and element to the left. ####What you need to know: - While it is very simple to implement, it is the least efficient of these three sorting methods. - Know that it moves one space to the right comparing two elements at a time and moving the smaller on to left. ####Big O efficiency: - Best Case Sort: Merge Sort: O(n) - Average Case Sort: Merge Sort: O(n^2) - Worst Case Sort: Merge Sort: O(n^2) ####Merge Sort Vs. Quicksort - Quicksort is likely faster in practice. - Merge Sort divides the set into the smallest possible groups immediately then reconstructs the incrementally as it sorts the groupings. - Quicksort continually divides the set by the average, until the set is recursively sorted. ## Basic Types of Algorithms ###**Recursive Algorithms** ####Definition: - An algorithm that calls itself in its definition. - **Recursive case** a conditional statement that is used to trigger the recursion. - **Base case** a conditional statement that is used to break the recursion. ####What you need to know: - **Stack level too deep** and **stack overflow**. - If you've seen either of these from a recursive algorithm, you messed up. - It means that your base case was never triggered because it was faulty or the problem was so massive you ran out of RAM before reaching it. - Knowing whether or not you will reach a base case is integral to correctly using recursion. - Often used in Depth First Search ###**Iterative Algorithms** ####Definition: - An algorithm that is called repeatedly but for a finite number of times, each time being a single iteration. - Often used to move incrementally through a data set. ####What you need to know: - Generally you will see iteration as loops, for, while, and until statements. - Think of iteration as moving one at a time through a set. - Often used to move through an array. ####Recursion Vs. Iteration - The differences between recursion and iteration can be confusing to distinguish since both can be used to implement the other. But know that, - Recursion is, usually, more expressive and easier to implement. - Iteration uses less memory. - **Functional languages** tend to use recursion. (i.e. Haskell) - **Imperative languages** tend to use iteration. (i.e. Ruby) - Check out this [Stack Overflow post](http://stackoverflow.com/questions/19794739/what-is-the-difference-between-iteration-and-recursion) for more info. ####Pseudo Code of Moving Through an Array (this is why iteration is used for this) ``` Recursion | Iteration ----------------------------------|---------------------------------- recursive method (array, n) | iterative method (array) if array[n] is not nil | for n from 0 to size of array print array[n] | print(array[n]) recursive method(array, n+1) | else | exit loop | ``` ###**Greedy Algorithm** ####Definition: - An algorithm that, while executing, selects only the information that meets a certain criteria. - The general five components, taken from [Wikipedia](http://en.wikipedia.org/wiki/Greedy_algorithm#Specifics): - A candidate set, from which a solution is created. - A selection function, which chooses the best candidate to be added to the solution. - A feasibility function, that is used to determine if a candidate can be used to contribute to a solution. - An objective function, which assigns a value to a solution, or a partial solution. - A solution function, which will indicate when we have discovered a complete solution. ####What you need to know: - Used to find the optimal solution for a given problem. - Generally used on sets of data where only a small proportion of the information evaluated meets the desired result. - Often a greedy algorithm can help reduce the Big O of an algorithm. ####Pseudo Code of a Greedy Algorithm to Find Largest Difference of any Two Numbers in an Array. ``` greedy algorithm (array) var largest difference = 0 var new difference = find next difference (array[n], array[n+1]) largest difference = new difference if new difference is > largest difference repeat above two steps until all differences have been found return largest difference ``` This algorithm never needed to compare all the differences to one another, saving it an entire iteration.

####
public
by canering
*822*
*2*
*3*
*0*

### 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.

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.:
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](https://gist.github.com/TSiege/cbb0507082bb18ff7e4b) 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](http://en.wikipedia.org/wiki/Tuple) from set theory. - They are one of the oldest, most commonly used data structures. ####What you need to know: - Optimal for indexing; bad at searching, inserting, and deleting (except at the end). - **Linear arrays**, or one dimensional arrays, are the most basic. - Are static in size, meaning that they are declared with a fixed size. - **Dynamic arrays** are like one dimensional arrays, but have reserved space for additional elements. - If a dynamic array is full, it copies it's contents to a larger array. - **Two dimensional arrays** have x and y indices like a grid or nested arrays. ####Big O efficiency: - Indexing: Linear array: O(1), Dynamic array: O(1) - Search: Linear array: O(n), Dynamic array: O(n) - Optimized Search: Linear array: O(log n), Dynamic array: O(log n) - Insertion: Linear array: n/a Dynamic array: O(n) ###**Linked List** ####Definition: - Stores data with **nodes** that point to other nodes. - Nodes, at its most basic it has one datum and one reference (another node). - A linked list _chains_ nodes together by pointing one node's reference towards another node. ####What you need to know: - Designed to optimize insertion and deletion, slow at indexing and searching. - **Doubly linked list** has nodes that reference the previous node. - **Circularly linked list** is simple linked list whose **tail**, the last node, references the **head**, the first node. - **Stack**, commonly implemented with linked lists but can be made from arrays too. - Stacks are **last in, first out** (LIFO) data structures. - Made with a linked list by having the head be the only place for insertion and removal. - **Queues**, too can be implemented with a linked list or an array. - Queues are a **first in, first out** (FIFO) data structure. - Made with a doubly linked list that only removes from head and adds to tail. ####Big O efficiency: - Indexing: Linked Lists: O(n) - Search: Linked Lists: O(n) - Optimized Search: Linked Lists: O(n) - Insertion: Linked Lists: O(1) ###**Hash Table or Hash Map** ####Definition: - Stores data with key value pairs. - **Hash functions** accept a key and return an output unique only to that specific key. - This is known as **hashing**, which is the concept that an input and an output have a one-to-one correspondence to map information. - Hash functions return a unique address in memory for that data. ####What you need to know: - Designed to optimize searching, insertion, and deletion. - **Hash collisions** are when a hash function returns the same output for two distinct inputs. - All hash functions have this problem. - This is often accommodated for by having the hash tables be very large. - Hashes are important for associative arrays and database indexing. ####Big O efficiency: - Indexing: Hash Tables: O(1) - Search: Hash Tables: O(1) - Insertion: Hash Tables: O(1) ###**Binary Tree** ####Definition: - Is a tree like data structure where every node has at most two children. - There is one left and right child node. ####What you need to know: - Designed to optimize searching and sorting. - A **degenerate tree** is an unbalanced tree, which if entirely one-sided is a essentially a linked list. - They are comparably simple to implement than other data structures. - Used to make **binary search trees**. - A binary tree that uses comparable keys to assign which direction a child is. - Left child has a key smaller than it's parent node. - Right child has a key greater than it's parent node. - There can be no duplicate node. - Because of the above it is more likely to be used as a data structure than a binary tree. ####Big O efficiency: - Indexing: Binary Search Tree: O(log n) - Search: Binary Search Tree: O(log n) - Insertion: Binary Search Tree: O(log n) ## Search Basics ###**Breadth First Search** ####Definition: - An algorithm that searches a tree (or graph) by searching levels of the tree first, starting at the root. - It finds every node on the same level, most often moving left to right. - While doing this it tracks the children nodes of the nodes on the current level. - When finished examining a level it moves to the left most node on the next level. - The bottom-right most node is evaluated last (the node that is deepest and is farthest right of it's level). ####What you need to know: - Optimal for searching a tree that is wider than it is deep. - Uses a queue to store information about the tree while it traverses a tree. - Because it uses a queue it is more memory intensive than **depth first search**. - The queue uses more memory because it needs to stores pointers ####Big O efficiency: - Search: Breadth First Search: O(|E| + |V|) - E is number of edges - V is number of vertices ###**Depth First Search** ####Definition: - An algorithm that searches a tree (or graph) by searching depth of the tree first, starting at the root. - It traverses left down a tree until it cannot go further. - Once it reaches the end of a branch it traverses back up trying the right child of nodes on that branch, and if possible left from the right children. - When finished examining a branch it moves to the node right of the root then tries to go left on all it's children until it reaches the bottom. - The right most node is evaluated last (the node that is right of all it's ancestors). ####What you need to know: - Optimal for searching a tree that is deeper than it is wide. - Uses a stack to push nodes onto. - Because a stack is LIFO it does not need to keep track of the nodes pointers and is therefore less memory intensive than breadth first search. - Once it cannot go further left it begins evaluating the stack. ####Big O efficiency: - Search: Depth First Search: O(|E| + |V|) - E is number of edges - V is number of vertices ####Breadth First Search Vs. Depth First Search - The simple answer to this question is that it depends on the size and shape of the tree. - For wide, shallow trees use Breadth First Search - For deep, narrow trees use Depth First Search ####Nuances: - Because BFS uses queues to store information about the nodes and its children, it could use more memory than is available on your computer. (But you probably won't have to worry about this.) - If using a DFS on a tree that is very deep you might go unnecessarily deep in the search. See [xkcd](http://xkcd.com/761/) for more information. - Breadth First Search tends to be a looping algorithm. - Depth First Search tends to be a recursive algorithm. ## Efficient Sorting Basics ###**Merge Sort** ####Definition: - A comparison based sorting algorithm - Divides entire dataset into groups of at most two. - Compares each number one at a time, moving the smallest number to left of the pair. - Once all pairs sorted it then compares left most elements of the two leftmost pairs creating a sorted group of four with the smallest numbers on the left and the largest ones on the right. - This process is repeated until there is only one set. ####What you need to know: - This is one of the most basic sorting algorithms. - Know that it divides all the data into as small possible sets then compares them. ####Big O efficiency: - Best Case Sort: Merge Sort: O(n) - Average Case Sort: Merge Sort: O(n log n) - Worst Case Sort: Merge Sort: O(n log n) ###**Quicksort** ####Definition: - A comparison based sorting algorithm - Divides entire dataset in half by selecting the average element and putting all smaller elements to the left of the average. - It repeats this process on the left side until it is comparing only two elements at which point the left side is sorted. - When the left side is finished sorting it performs the same operation on the right side. - Computer architecture favors the quicksort process. ####What you need to know: - While it has the same Big O as (or worse in some cases) many other sorting algorithms it is often faster in practice than many other sorting algorithms, such as merge sort. - Know that it halves the data set by the average continuously until all the information is sorted. ####Big O efficiency: - Best Case Sort: Merge Sort: O(n) - Average Case Sort: Merge Sort: O(n log n) - Worst Case Sort: Merge Sort: O(n^2) ###**Bubble Sort** ####Definition: - A comparison based sorting algorithm - It iterates left to right comparing every couplet, moving the smaller element to the left. - It repeats this process until it no longer moves and element to the left. ####What you need to know: - While it is very simple to implement, it is the least efficient of these three sorting methods. - Know that it moves one space to the right comparing two elements at a time and moving the smaller on to left. ####Big O efficiency: - Best Case Sort: Merge Sort: O(n) - Average Case Sort: Merge Sort: O(n^2) - Worst Case Sort: Merge Sort: O(n^2) ####Merge Sort Vs. Quicksort - Quicksort is likely faster in practice. - Merge Sort divides the set into the smallest possible groups immediately then reconstructs the incrementally as it sorts the groupings. - Quicksort continually divides the set by the average, until the set is recursively sorted. ## Basic Types of Algorithms ###**Recursive Algorithms** ####Definition: - An algorithm that calls itself in its definition. - **Recursive case** a conditional statement that is used to trigger the recursion. - **Base case** a conditional statement that is used to break the recursion. ####What you need to know: - **Stack level too deep** and **stack overflow**. - If you've seen either of these from a recursive algorithm, you messed up. - It means that your base case was never triggered because it was faulty or the problem was so massive you ran out of RAM before reaching it. - Knowing whether or not you will reach a base case is integral to correctly using recursion. - Often used in Depth First Search ###**Iterative Algorithms** ####Definition: - An algorithm that is called repeatedly but for a finite number of times, each time being a single iteration. - Often used to move incrementally through a data set. ####What you need to know: - Generally you will see iteration as loops, for, while, and until statements. - Think of iteration as moving one at a time through a set. - Often used to move through an array. ####Recursion Vs. Iteration - The differences between recursion and iteration can be confusing to distinguish since both can be used to implement the other. But know that, - Recursion is, usually, more expressive and easier to implement. - Iteration uses less memory. - **Functional languages** tend to use recursion. (i.e. Haskell) - **Imperative languages** tend to use iteration. (i.e. Ruby) - Check out this [Stack Overflow post](http://stackoverflow.com/questions/19794739/what-is-the-difference-between-iteration-and-recursion) for more info. ####Pseudo Code of Moving Through an Array (this is why iteration is used for this) ``` Recursion | Iteration ----------------------------------|---------------------------------- recursive method (array, n) | iterative method (array) if array[n] is not nil | for n from 0 to size of array print array[n] | print(array[n]) recursive method(array, n+1) | else | exit loop | ``` ###**Greedy Algorithm** ####Definition: - An algorithm that, while executing, selects only the information that meets a certain criteria. - The general five components, taken from [Wikipedia](http://en.wikipedia.org/wiki/Greedy_algorithm#Specifics): - A candidate set, from which a solution is created. - A selection function, which chooses the best candidate to be added to the solution. - A feasibility function, that is used to determine if a candidate can be used to contribute to a solution. - An objective function, which assigns a value to a solution, or a partial solution. - A solution function, which will indicate when we have discovered a complete solution. ####What you need to know: - Used to find the optimal solution for a given problem. - Generally used on sets of data where only a small proportion of the information evaluated meets the desired result. - Often a greedy algorithm can help reduce the Big O of an algorithm. ####Pseudo Code of a Greedy Algorithm to Find Largest Difference of any Two Numbers in an Array. ``` greedy algorithm (array) var largest difference = 0 var new difference = find next difference (array[n], array[n+1]) largest difference = new difference if new difference is > largest difference repeat above two steps until all differences have been found return largest difference ``` This algorithm never needed to compare all the differences to one another, saving it an entire iteration.

####
public
by Phalacrocorax
*232*
*0*
*3*
*0*

### JOB | INTERVIEWE | FRONTEND

JOB | INTERVIEWE | FRONTEND:
JOB-FRONTEND.md

Come From [如何面试web前端开发工程师](http://blog.csdn.net/zhut_acm/aricle/details/44944831) ## BASEMENT 应该独立掌握的知识 - DOM结构--两个节点之间可能存在哪些关系以及如何在节点之间任意移动 - DOM操作--怎样添加、移除、移动、复制、创建和查找节点 - 事件--怎样使用事件以及IE和DOM事件模型之间存在哪些主要差别 - XTMLHttpRequest--这是什么、怎样完整的执行一次GET请求、怎样检测错误 - 严格模式与混杂模式--如何触发这两种模式，区分它们有何意义 - 盒模型--外边距、内边距和边框之间的关系，IE8以下版本的浏览器中的盒模型有什么不同。 - 块级元素与行内元素--怎么CSS控制它们、它们怎样影响周围的元素以及你觉得应该如何定义它们的样式。 - 浮动元素--怎么使用、有什么问题以及解决办法。 - HTML与XHTML--二者区别，应该使用哪个。 - JSON--为什么使用它，怎么使用。 ## ANSWER W3C ： /document-node/element-node/text-node/attribute-node/note-node - [父子节点，兄弟节点，后代节点，祖先节点]（http://www.cnblogs.com/samwu/archive/2012/07/08/2581645.html） - #add# appendChild(node),insertBefore()| #delete# removeChild(node) | #search&move# parentNode firstChild children appendChild（node） | #clone# cloneNode(include_all)

####
public
by JKCPR
*525*
*0*
*4*
*0*

### Fibonacci meh

Loops over the Fibonnaci sequence...might be useful in an interview.

function fibonacci(num, memo) { memo = memo || {}; return memo[num]? memo[num]: num < 2? 1: memo[num] = fibonacci(num - 1, memo) + fibonacci(num - 2, memo); } for(var i=0;i<100;i=i+1){ this.console.log(fibonacci(i)); }

####
external
by Christopher Sabater Cordero
*12*
*0*
*1*
*0*

### These are my notes for Technical Interviews using TSiege's interview notes and also Cracking the Coding Interview.

These are my notes for Technical Interviews using TSiege's interview notes and also Cracking the Coding Interview.:
Technical Interview Prep.md

# Technical Interview Notes ## Arrays and Strings #### Array **Topics:** - Sizing - In more statically typed languages, you have to worry about the size of an array. - In its most basic implementation, arrays store data sequentially with **fixed** space. If you want to use an array that can be resized, you must implement a solution to allow it to grow in size. - The most common resizing method is to create a new array with double the size of the first array, then copy the elements of the first array to the new array. - In Python, lists are implemented as resizeable arrays, so thankfully, you do not have to worry about this. - Optimization - If an array is sorted, you can think about doing optimized search methods, like with a binary search. **Big O efficiency:** - Indexing: O(1) - Search: O(n) - Insertion: O(n) - Optimized Search: O(log n) #### Hash Tables / Maps **Topics:** - Hashing - A hash table is a structure that stores arbitrary data. In Python, sets are a hash table. It need not be a storage of key-value pairs. - A hash map is a hash table, but with a collection of key-value pairs. - The relationship between a pair is based on a hash function. - When you provide a hash table with a new key, a hash function takes the key and generates a hash value. - The data structure underlying a hash table/map need not be thought of as an array. You could implement the back-end of a hash table to be a balanced binary search tree, and the hash value result from the hash algorithm would point you to where in the tree your value is. A BST hash table would have O(logN) lookup, but would potentially use less space. - Collisions - Two distinct pieces of data have the same hash value - Put more simply, if you have two keys, 'a' and 'b' and in the hash map, the hash algorithm generates the exact same hash value, we have a collision. - To handle collisions, two common ways would be to run the hash algorithm on the result recursively until you reach an unused hash value. Other ways would be to look around from the collision to find a new hash value. - If the number of collisions is very high, the worst case runtime to retrieve an element starts to approach O(N). **Big O efficiency:** - Indexing: O(1) - Search: O(1) - Insertion: O(1) ### Array and String Methods 1. isUnique() - Determine if a string or list has all unique elements. Attempt to do so without any additional data structures. 2. checkPermutation() - Given two strings, determine if one is a permutation of the other. 3. URLify() - Write a method to replace all spaces in a string with '%20'. Trim any spaces on the end. 4. palindromePermutation() - Given one string, determine if it is a permutation of a palindrome. 5. oneAway() - There are three possible edits to a string: insert a character, remove a character, or replace a character. Given two strings, write a function to check whether they are one edit or zero edits away. 6. stringCompression() - Implement a method to perform basic string compression using the counts of repeated characters, i.e. 'aabcccccaaa' --> 'a2b1c5a3' 7. rotateMatrix() - Given a 2D array of NxN size, rotate the array 90 degrees **in place**. 8. zeroMatrix() - Given a 2D array of MxN size, if an element is 0, its entire row and column are set to 0. 9. stringRotation() - Assume you have a method isSubstring() which checks if one word is a substring of another. Given two strings s1 and s2, write code to check if s2 is a rotation of s1 using only one call to isSubstring().

####
external
by Github
*296*
*0*
*3*
*0*

### Do you like it here? http://chabotmuseum.nl/amoxicillin-400mg5ml-suspension/ declaration novamox 500 mg amoxicillin some foolish In an interview with the St. Louis Post-Dispatch in 1995, Franklin admitted membership in the Ku Klux Klan and the America...

Do you like it here? http://chabotmuseum.nl/amoxicillin-400mg5ml-suspension/ declaration novamox 500 mg amoxicillin some foolish In an interview with the St. Louis Post-Dispatch in 1995, Franklin admitted membership in the Ku Klux Klan and the American Nazi Party and said he had changed his own name to honor Joseph Paul Goebbels, Hitler's minister

Do you like it here? http://chabotmuseum.nl/amoxicillin-400mg5ml-suspension/ declaration novamox 500 mg amoxicillin some foolish In an interview with the St. Louis Post-Dispatch in 1995, Franklin admitted membership in the Ku Klux Klan and the American Nazi Party and said he had changed his own name to honor Joseph Paul Goebbels, Hitler's minister of propaganda. http://www.safetracker.biz/wellbutrin-xl-300-mg-online/ assume best price wellbutrin xl 300mg morning wooden The Post reported that Paschke routinely travels to Jets home games at MetLife Stadium in a special "Jets Mobile" bus with his father, Kurt Sr., a retired police officer and Jets season ticket holder.

####
external
by LuizZak
*34*
*0*
*2*
*0*

### LINQPad runnable resolution to the Fix the Index interview problem (http://ayende.com/blog/170402/interview-question-fix-the-index)

LINQPad runnable resolution to the Fix the Index interview problem (http://ayende.com/blog/170402/interview-question-fix-the-index):
gistfile1.cs

void Main() { var tests = new IndexTests(); tests.CanIndexAndQuery(); tests.CanUpdate(); } // Internal doc class class Document { public readonly string Id; // Let's pretend there is a constructor that initializes this value... public List<string> Contents; // Probably turn this into a property later... public Document(string id) { Id = id; } public override int GetHashCode() { return Id.GetHashCode(); } public override bool Equals(object other) { if(ReferenceEquals(other, this)) return true; if(ReferenceEquals(other, null)) return false; if(other is Document) return Equals((Document)other); return false; } public bool Equals(Document other) { return other.Id == Id; } } // Interface for indexers interface IIndexer { void Index(string docId, string text); List<string> Query(string term); void Delete(string docId); } // Iterative-implemented hashset indexer, should be clearer than the Linq implementation class IterativeHashIndexer : IIndexer { private HashSet<Document> docs = new HashSet<Document>(); public void Index(string docId, string text) { Document doc = new Document(docId); doc.Contents = new List<string>(text.Split()); docs.Remove(doc); docs.Add(doc); } public List<string> Query(string term) { var ret = new List<string>(); foreach(var doc in docs) { if(doc.Contents.Any(s => s.Equals(term, StringComparison.OrdinalIgnoreCase))) { ret.Add(doc.Id); } } return ret; } public void Delete(string docId) { docs.RemoveWhere(d => d.Id == docId); } } class LinqHashIndexer : IIndexer { private HashSet<Document> docs = new HashSet<Document>(); public void Index(string docId, string text) { Document doc = new Document(docId); doc.Contents = new List<string>(text.Split()); docs.Remove(doc); docs.Add(doc); } public List<string> Query(string term) { // This gets a little convoluted, but you can always transform this into a loop return docs.Where ( d => d.Contents .Any ( s => s.Equals(term, StringComparison.OrdinalIgnoreCase) ) ) .Select(d => d.Id) .ToList(); } public void Delete(string docId) { docs.RemoveWhere(d => d.Id == docId); } } class DictionaryIndexer : IIndexer { private Dictionary<string, Document> docs = new Dictionary<string, Document>(); public void Index(string docId, string text) { Document doc = new Document(docId); doc.Contents = new List<string>(text.Split()); docs[docId] = doc; } public List<string> Query(string term) { var ret = new List<string>(); foreach(var kv in docs) { if(kv.Value.Contents.Any(s => s.Equals(term, StringComparison.OrdinalIgnoreCase))) { ret.Add(kv.Key); } } return ret; } public void Delete(string docId) { docs.Remove(docId); } } public class IndexTests { IIndexer CreateIndexer() { // Change with any of the implementations above return new DictionaryIndexer(); } [Fact] public void CanIndexAndQuery() { var index = CreateIndexer(); index.Index("users/1", "Oren Eini"); index.Index("users/2", "Hibernating Rhinos"); Assert.Contains("users/1", index.Query("eini")); Assert.Contains("users/2", index.Query("rhinos")); } [Fact] public void CanUpdate() { var index = CreateIndexer(); index.Index("users/1", "Oren Eini"); //updating index.Index("users/1", "Ayende Rahien"); Assert.Contains("users/1", index.Query("Rahien")); Assert.Empty(index.Query("eini")); } [Fact] public void CanDelete() { var index = CreateIndexer(); index.Index("users/1", "Oren Eini"); index.Index("users/2", "Hibernating Rhinos"); index.Delete("users/1"); Assert.NotContains("users/1", index.Query("eini")); Assert.Contains("users/2", index.Query("rhinos")); } } // Dummy implementation of the Assert class above, so the code can be executed on LinqPad static class Assert { public static void Contains<T>(T value, IEnumerable<T> values) { if(!values.Contains(value)) { throw new Exception(); } } public static void NotContains<T>(T value, IEnumerable<T> values) { if(values.Contains(value)) { throw new Exception(); } } public static void Empty<T>(IEnumerable<T> contents) { if(contents.Any()) { throw new Exception(); } } } // Implementing this attribute so the code can run by just removing this FactAttribute and dummy Assert implementation above and running on VisualStudio class FactAttribute : Attribute { }

####
external
by Github
*217*
*0*
*3*
*0*

### We'd like to invite you for an interview https://www.tca.nl/can-flagyl-cause-bladder-infection.pdf graphic darkened flagyl forte 500 mg metronidazole boarding where So forget the bandage dresses, the low cut tops and skimpy skirts. Try a casual, didn&...

We'd like to invite you for an interview https://www.tca.nl/can-flagyl-cause-bladder-infection.pdf graphic darkened flagyl forte 500 mg metronidazole boarding where So forget the bandage dresses, the low cut tops and skimpy skirts. Try a casual, didn't try too hard for you vibe that's sure to keep him guessing. Charlize has got it just rig

We'd like to invite you for an interview https://www.tca.nl/can-flagyl-cause-bladder-infection.pdf graphic darkened flagyl forte 500 mg metronidazole boarding where So forget the bandage dresses, the low cut tops and skimpy skirts. Try a casual, didn't try too hard for you vibe that's sure to keep him guessing. Charlize has got it just right in this simple ensemble and looks sophisticated and chic as well as drop dead gorgeous - it helps that she's Charlize Theron of course so whatever she threw on she'd always look divine.

####
external
by Dominique Luna
*504*
*0*
*3*
*0*

### interview questions (if you are the interviewee)

interview questions (if you are the interviewee):
questions.txt

Some questions to ask during interviews: * What does success look like for this position? How will I know if I am accomplishing what is expected of me? * What is the last project you shipped? What was the goal, how long did it take, what were the stumbling blocks, what tools did you use, etc. * What will my first 90 days in this role look like? First 180 days? * Who will I report to and how many people report to that person? Do they have regular 1:1 with their team members? * Why did the last person who quit this team leave? The company? * If a startup, how long is your runway? How are financial decisions made? * What would be my first project here? Has someone already been working on this or is this in the aspirational stage? * What is the current state of the data infrastructure? How much work needs to be done on getting the infrastructure and pipeline into shape before we start analyzing that data?