'one sentence from a magazine', 'ransom note' => True
'one payment', 'pay money' => False
'downpayment', 'pay now' => True
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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.
Input: Integer greater than 0 and less than 4000.
Output: Integer greater than 0.
Examples:
Input | Output |
---|---|
583 | 53222000 |
888 | 544432221000 |
http://www.shortcutworld.com/en/linux/Emacs_23.2.1.html
Command | Description |
---|---|
C-x b | Switch buffer. |
C-/ | Undo. |
C-s | Search forward. |
C-r | Search backward. |