- 重建二叉树 -> https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/
- √矩阵中的路径 -> https://leetcode.com/problems/word-search/
- 机器人的运动范围 -> 没找到
- 剪绳子(dp) -> 没找到
- √二进制中1的个数 -> https://leetcode.com/problems/number-of-1-bits/ ->(升级版)https://leetcode.com/problems/counting-bits/
- √数值的整数次方(溢出) -> https://leetcode.com/problems/powx-n/
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
// Parsing arbitrary JSON using interfaces in Go | |
// Demonstrates how to parse JSON with abritrary key names | |
// See https://blog.golang.org/json-and-go for more info on generic JSON parsing | |
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) |
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
//This sample is how to use websocket of Tomcat. | |
package wsapp; | |
import java.io.IOException; | |
import java.nio.ByteBuffer; | |
import java.nio.CharBuffer; | |
import java.util.ArrayList; | |
import org.apache.catalina.websocket.MessageInbound; | |
import org.apache.catalina.websocket.StreamInbound; | |
import org.apache.catalina.websocket.WebSocketServlet; |
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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace LambdaExpressionTree | |
{ |
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
# aecho.py | |
from socket import * | |
import asyncio | |
loop = asyncio.get_event_loop() | |
async def echo_server(address): | |
sock = socket(AF_INET, SOCK_STREAM) | |
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) |
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
<VirtualHost *> | |
ServerName example.com | |
WSGIDaemonProcess www user=max group=max threads=5 | |
WSGIScriptAlias / /home/max/Projekte/flask-upload/flask-upload.wsgi | |
<Directory /home/max/Projekte/flask-upload> | |
WSGIProcessGroup www | |
WSGIApplicationGroup %{GLOBAL} | |
Order deny,allow |
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
import os | |
# We'll render HTML templates and access data sent by POST | |
# using the request object from flask. Redirect and url_for | |
# will be used to redirect the user once the upload is done | |
# and send_from_directory will help us to send/show on the | |
# browser the file that the user just uploaded | |
from flask import Flask, render_template, request, redirect, url_for, send_from_directory | |
from werkzeug import secure_filename | |
# Initialize the Flask application |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>items</key> | |
<array> | |
<dict> | |
<key>assets</key> | |
<array> | |
<dict> |
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
public HttpResponseMessage Post(string version, string environment, string filetype) | |
{ | |
var path = @"C:\Temp\test.exe"; | |
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); | |
var stream = new FileStream(path, FileMode.Open); | |
result.Content = new StreamContent(stream); | |
result.Content.Headers.ContentType = | |
new MediaTypeHeaderValue("application/octet-stream"); | |
return result; | |
} |
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
//It's very simple: | |
using (var md5 = MD5.Create()) | |
{ | |
using (var stream = File.OpenRead(filename)) | |
{ | |
return md5.ComputeHash(stream); | |
} | |
} | |
//(I believe that actually the MD5 implementation used doesn't need to be disposed, but I'd probably still do so anyway.) |
NewerOlder