Consider the following straightforward mutable queue implementation using two stacks:
type 'a adt_queue = {
mutable head : 'a head;
mutable tail : 'a tail;
}
module type T = sig | |
module type S | |
end | |
module T = struct | |
module type S = T | |
end | |
module type K_Bool = functor (X : T) (Y : T) -> T |
type NatModule<Nat> = { | |
zero: Nat; | |
one: Nat; | |
add: (x: Nat, y: Nat) => Nat; | |
}; | |
const NatModule = <A>(cb: <Nat>(Nat: NatModule<Nat>) => A) => { | |
const zero = 0; | |
const one = 1; |
-------------------------------------------- | |
Version: 1.45.1 | |
Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a | |
Date: 2020-05-14T08:33:47.663Z | |
Electron: 7.2.4 | |
Chrome: 78.0.3904.130 | |
Node.js: 12.8.1 | |
V8: 7.8.279.23-electron.0 | |
OS: Darwin x64 18.5.0 | |
------------------------------------------- |
/* | |
(Dumb) idea to implement the classic FizzBuzz | |
problem as a state machine with 16 states. | |
*/ | |
#include <iostream> | |
#include <vector> | |
#include <functional> | |
#include <stdlib.h> |
I bundled these up into groups and wrote some thoughts about why I ask them!
If these helped you, I'd love to hear about it!! I'm on twitter @vcarl_ or send me an email carl.vitullo@gmail.com
https://blog.vcarl.com/interview-questions-onboarding-workplace/
const some_module = require('some_module') | |
/** | |
* require('some_module') calls Module._load | |
* | |
* Module._load then tries to load the module with a filename (also save it to the cache) using module.load(filename) | |
* | |
* module.load(filename), given a filename, passes it to the proper extension handler ('.js', '.json') | |
* | |
* If there were any errors when loading the file, it deletes the file from the cache (delete Module._cache[filename]) and throws an error |
// mock file | |
function MockFile() { }; | |
MockFile.prototype.create = function (name, size, mimeType) { | |
name = name || "mock.txt"; | |
size = size || 1024; | |
mimeType = mimeType || 'plain/txt'; | |
function range(count) { | |
var output = ""; |
// Trie.js - super simple JS implementation | |
// https://en.wikipedia.org/wiki/Trie | |
// ----------------------------------------- | |
// we start with the TrieNode | |
function TrieNode(key) { | |
// the "key" value will be the character in sequence | |
this.key = key; | |