题目:Write a function to find the longest common prefix string amongst an array of strings.代码:class Solution {public: string longestCommonPrefix(vect...
分类:
其他好文 时间:
2015-05-10 18:56:18
阅读次数:
109
→读某行某列的操作:Edit1.Text := listview1.Items[i].Caption; //读第i行第1列Edit2.Text := listview1.Items[i].SubItems.strings[0]; //读第i行第2列Edit3.Text := listview1.It...
分类:
其他好文 时间:
2015-05-10 11:13:35
阅读次数:
117
https://leetcode.com/problems/multiply-strings/Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The nu...
分类:
其他好文 时间:
2015-05-09 20:18:04
阅读次数:
129
本文主要介绍如何为应用程序添加基于AlertDialog的对话框,使用DialogFragment呈现该对话框。可以为对话框创建一个标题的string资源,在values/strings.xml中添加字符串str。创建一个DialogFragment,选择android.support.v4.app...
分类:
移动开发 时间:
2015-05-09 11:30:04
阅读次数:
135
Codeforces Round #302 (Div. 2)A. Set of Strings字符串 q 被称为 "beautiful" 当且仅当 q 可以被拆分成 k 个子串 (s1, s2, s3, ... , sk) 并且任意两个字串满足首字母不一样。直接模拟,对 q 的每个字符进行判断,如果...
分类:
其他好文 时间:
2015-05-08 23:25:31
阅读次数:
146
题目传送门 1 /* 2 题意:一个字符串分割成k段,每段开头字母不相同 3 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 4 */ 5 #include 6 #include 7 #include 8 #include 9 #inclu...
分类:
其他好文 时间:
2015-05-08 21:42:07
阅读次数:
130
Problem:
Write a function to find the longest common prefix string amongst an array of strings.
Solution:
时间复杂度O(n)
题目大意:
给一个字符串数组,要找到这些字符串的最大前缀公共子串。
解题思路:
既然是公共子串,那每个字符串肯定都包含有,并且在头部,首先把第...
分类:
编程语言 时间:
2015-05-08 20:22:43
阅读次数:
139
Write a function to find the longest common prefix string amongst an array of strings.
求若干字符串的最长公共前缀。
首先若无字符串,返回“”;接下来求得其中最短字符串的长度len,比较公共前缀只需最多比较len次;最后比较所有字符串里每一位上的字符。
class Solution {
public:
...
分类:
其他好文 时间:
2015-05-08 18:12:00
阅读次数:
152
Compare two version numbers version1 and version2.
If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and cont...
分类:
其他好文 时间:
2015-05-08 12:59:47
阅读次数:
130
题目传送:Codeforces Round #302 (Div. 2)
A. Set of Strings
思路:注意开头字母都不相同
AC代码:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
...
分类:
其他好文 时间:
2015-05-08 10:57:38
阅读次数:
352