public class MethodReferenceDemo1 { @FunctionalInterface interface StringListFormatter { String format(String delimiter, List list); } public static v...
分类:
编程语言 时间:
2015-01-27 17:54:22
阅读次数:
228
此方法是取C#文件里面的方法块,并删除缩进符,感觉写得还是比较容易懂的,所以收藏下,以便将来用到. private static string GetCodeBlock(string allCode, string blockName) { in...
题目:Given a string S,
find the longest palindromic substring in S.
You may assume that the maximum length of S is
1000, and there exists one unique longest palindromic substring.
下面是英文,祝你好运
...
分类:
其他好文 时间:
2015-01-27 16:35:09
阅读次数:
363
今天主要看下re.sub函数和Handler类的sub函数
先看下re.sub函数
re.sub共有5个参数,不过一般写前三个就好了,即pattern,repl和string
pattern表示正则中的模式字符串,repl可以是字符串,也可以是函数。string为要进行替换的字符串
先看一段代码:
import re
def Num2A(match):
return 'A'
a...
分类:
编程语言 时间:
2015-01-27 16:28:12
阅读次数:
219
原题链接:https://oj.leetcode.com/problemset/algorithms/
这里用递归的方法实现。递归函数签名为void generate(int left, int right, int n, string prev)
1. left,right分别为当前左右括号的个数,prev缓存之前的临时结果
2. left小于n的时候,可以一直加入左括号
3. ...
分类:
其他好文 时间:
2015-01-27 16:28:01
阅读次数:
120
题目:The string "PAYPALISHIRING" is written
in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S...
分类:
其他好文 时间:
2015-01-27 16:26:55
阅读次数:
172
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.
Below is one possible representation of s1 = "great":
great
/ gr ...
分类:
其他好文 时间:
2015-01-27 16:25:51
阅读次数:
169
Given a string S,
find the longest palindromic substring in S.
You may assume that the maximum length of S is
1000, and there exists one unique longest palindromic substring.
#include
#includ...
分类:
其他好文 时间:
2015-01-27 15:02:38
阅读次数:
164
public static void LoadPicFromStream(string url) { string content = string.Empty; HttpWebRequest request = (HttpWebR...
分类:
其他好文 时间:
2015-01-27 14:49:25
阅读次数:
169
1,? import java.util.Scanner
/**
* Author: bruce
* Date: 2015-01-24
*/
object ConsoleScanner {
def main(args: Array[String]) {
println("Please enter a phase: ");
val scan = new Scanner(...
分类:
其他好文 时间:
2015-01-27 13:38:04
阅读次数:
153