https://leetcode.com/problems/add-binary/Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"1...
分类:
编程语言 时间:
2015-05-17 21:48:42
阅读次数:
128
Isomorphic Strings Given two stringssandt, determine if they are isomorphic. Two strings are isomorphic if the characters inscan be replaced to gett.A...
分类:
编程语言 时间:
2015-05-17 18:27:27
阅读次数:
137
1 Multiply Strings
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.
该题实际就是利用字符串来解决大数的乘法问题。为了...
分类:
编程语言 时间:
2015-05-17 16:50:18
阅读次数:
159
//很容易可以判断当两个字符串相等或者长度相加为奇数时第一个赢
//用map存入每一个字符串标号,对应找出每一个字符串有多少个以及其长度是奇数还是偶数
//则很容易求得答案
#include
#include
#include
#include
using namespace std ;
const int maxn = 200010 ;
typedef __int64 ll ;...
分类:
其他好文 时间:
2015-05-17 15:22:08
阅读次数:
222
ZCC loves strings
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Others)
...
分类:
其他好文 时间:
2015-05-17 15:21:15
阅读次数:
126
结论:对于串a和b,游戏中先手必胜当且仅当|a|+|b|为奇数或a=b.
我们按|a|+|b|的大小从小到大考虑所有的情况。
当|a|+|b|=0时,显然先手必败,符合结论。
假设已经证明了|a|+|b|=k的所有情况满足结论,现在考虑|a|+|b|=p的情况。
若p是奇数,先手只需要选择长度较短的不为空的串,并使用A操作,就可以转移到|a|+|b|为偶数并且两个串不相等或者两...
分类:
其他好文 时间:
2015-05-17 15:19:18
阅读次数:
81
不可变类 - String一如既往,在进行学习之前我们先看看相关的定义吧~下面引自 JavaDocs:
Strings are constant; their values cannot be changed after they are created
String 类是不可变的,String 对象的值在创建后不会发生改变。换句话说,我们平常对 String 对象的操作,实际上都是创建了一个新...
分类:
其他好文 时间:
2015-05-17 12:16:28
阅读次数:
90
ZCC loves strings
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Others)
Total Submission(s): 184 Accepted Submission(s): 70
Problem Description
ZCC has g...
分类:
其他好文 时间:
2015-05-17 00:53:05
阅读次数:
169
题目描述:Find a longest common subsequence of two strings.输入:First and second line of each input casecontain two strings of lowercase character a…z. There...
分类:
其他好文 时间:
2015-05-16 18:13:58
阅读次数:
99
Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100".解题思路:JAVA实现如下:static public String addBinar...
分类:
编程语言 时间:
2015-05-16 13:16:18
阅读次数:
172