这个也是简单题目,但是关键在于题意的理解。
题目原文就一句话:Write a function to find the longest common prefix string amongst an array of strings.
题意是给一个字符串数组,找出这个字符串数组中所有字符串的最长公共前缀。
注意是限定的前缀,而不是子串。...
分类:
其他好文 时间:
2015-07-17 22:53:11
阅读次数:
134
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
思路:二进制加法,比较简单。代码如下:
public class Solution {
public String addBinary(Strin...
分类:
其他好文 时间:
2015-07-17 18:56:43
阅读次数:
129
题目:
Write a function to find the longest common prefix string amongst an array of strings.
就是要求一些字符串的最长公共前缀。
code:
class Solution {
public:
string longestCommonPrefix(vector& strs) {...
分类:
其他好文 时间:
2015-07-17 14:09:38
阅读次数:
116
1.8 Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 i...
分类:
其他好文 时间:
2015-07-17 07:08:39
阅读次数:
104
1.3 Given two strings, write a method to decide if one is a permutation of the other.这道题给定我们两个字符串,让我们判断一个是否为另一个的全排列字符串。在LeetCode中,关于排列的题有如下几道,Permutat...
分类:
其他好文 时间:
2015-07-16 09:36:18
阅读次数:
138
题目链接
题意:
给定n个长度均为m的字符串
下面n行给出字符串
下面n*m的矩阵表示把对应的字母修改成其他字母的花费。
问:
对于一个字符串,若它是easy to remembering 当 它存在一个字母,使得这个字母在这一列是独一无二的。
要使得n个字符串都是easy to remembering 的最小花费。
第一个样例是把第一列的4个a中3个a修改成别的字母,所以花费为3...
分类:
其他好文 时间:
2015-07-15 22:49:06
阅读次数:
159
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".求数字字符串的二进制和。同之前的数组代表数字,两个数组相加一样。仅仅只是进位变成了2.可能两个...
分类:
其他好文 时间:
2015-07-15 22:33:49
阅读次数:
113
package main
import (
"flag"
"fmt"
"net/http"
"os/exec"
"path/filepath"
"strings"
"sync"
"text/template"
)
const L = `
文件列表
{{$ip := .IP}}
{...
分类:
其他好文 时间:
2015-07-14 22:47:53
阅读次数:
160
题目:
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
题意:
给定一个字符串数组,返回所有的易位构词组合。
注意:所有的输入都是小写。
算法分析:
易位构词其实也很好理解,就是两个单...
分类:
编程语言 时间:
2015-07-14 22:41:56
阅读次数:
149
TRegEx#include void __fastcall TForm1::Button1Click(TObject *Sender){ const String bigString = "Look for a the strings in this strang of strungs."; .....
分类:
其他好文 时间:
2015-07-14 17:15:05
阅读次数:
104