Skip to content

Instantly share code, notes, and snippets.

@jrusev
jrusev / server.js
Last active February 16, 2018 12:45
var http = require('http');
var port = 1234;
http.createServer(function (req, resp) {
var body = [];
req.on('data', function (chunk) { body.push(chunk); });
req.on('end', function () {
body = Buffer.concat(body).toString();
console.log({headers: req.headers, method: req.method, body: body});
resp.writeHead(200, {'Content-Type': 'text/plain'});
resp.end('OK');

The Product Manager Interview

Measure

  • product sense (discuss products, design, creativity, thinking from first principles)
  • execution/collaboration/metrics
  • analytical skills
  • technical depth

Questions

package main
import "fmt"
import "time"
func f(in <-chan int, out chan<- int) {
for j := range in {
time.Sleep(time.Second)
out <- j * 2
}
@jrusev
jrusev / parse.py
Last active February 17, 2017 21:09
def parse(s):
"""Parse a JSON string containing only integers and arrays."""
return int(s) if s[0].isdigit() else parse_array(s, 1)[0]
def parse_array(s, i):
"""Return the array beginning at index i and the end index of the array."""
res = []
while s[i] != ']':
if s[i].isdigit():
start = i
@jrusev
jrusev / no_problem.md
Last active September 12, 2016 12:52

Input: Integer greater than 0 and less than 4000.

Output: Integer greater than 0.

Examples:

Input Output
583 53222000
888 544432221000

problems

Problem 1. Ransom note

'one sentence from a magazine', 'ransom note' => True
'one payment', 'pay money' => False
'downpayment', 'pay now' => True

tests

Problem 1. Ransom Note

A kidnapper wishes to write a ransom note using letters from a magazine. Given the ransom note and the magazine, find if the kidnapper can write the note by cutting letters out of the magazine.

Problem 2. Brackets

@jrusev
jrusev / emacs-cmds.md
Last active January 19, 2016 14:05
Useful commands for working with Clojure in Emacs