背景:主要是学习map相关知识,详见代码
我的代码:#include
#include
#include
#include
#include
using namespace std;
map map1;
mapmap2;
vector vector1,ans;
string string1_lower(string string1){
for(int i=0;i < stri...
分类:
其他好文 时间:
2015-02-06 09:38:26
阅读次数:
106
背景:做了这么久的题,唯一一道一次ac的,可见这道题是如何的简单。
思路:思路很清楚的模拟题,先排序再查找。
学习:sort函数和lower_bound函数,sort函数排序就不多说了,lower_bound函数作用是查找一个数组中大于等于x的第一个位置。#include
#include
#include
using namespace std;
int figue[10000];
v...
分类:
其他好文 时间:
2015-02-05 23:25:29
阅读次数:
176
AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.思路:什么是anagrams?傻逼了,百度吧。一百度全是别...
分类:
其他好文 时间:
2015-02-04 23:02:59
阅读次数:
137
Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe...
分类:
其他好文 时间:
2015-02-03 14:37:44
阅读次数:
128
Length of Last Word
Total Accepted: 32811 Total
Submissions: 113876My Submissions
Question
Solution
Given a string s consists of upper/lower-case alphabets and empty space charact...
分类:
其他好文 时间:
2015-02-01 16:12:14
阅读次数:
148
1 /* 2 3 4 L (>=60), the lower bound of the qualified grades -- 5 that is, only the ones whose grades of talent and virtue are both not below...
分类:
其他好文 时间:
2015-02-01 08:28:31
阅读次数:
171
前段时间忙数据交换,有一个多月没写java了。。找找手感,刷刷题吧。。
去leetcode上挑了个简单的,题目是这样的。
Given a string s consists of upper/lower-case alphabets and empty space characters '
', return the length of last word in the strin...
分类:
其他好文 时间:
2015-01-31 19:28:22
阅读次数:
168
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
算法思路:
将单词进行排序。
用map统计排序后相等的出现次数。
将次数大于1的单词放入结果集。
第1次出现时,因次数最终是否大于1不明郎,将其暂存入...
分类:
其他好文 时间:
2015-01-31 16:29:04
阅读次数:
153
题意 从4个n元集中各挑出一个数 使它们的和为零有多少种方法
直接n^4枚举肯定会超时的 可以把两个集合的元素和放在数组里 然后排序 枚举另外两个集合中两元素和 看数组中是否有其相反数就行了 复杂度为n^2*logn
#include
#define l(i) lower_bound(s,s+m,i)
#define u(i) upper_bound(s,s+m,i)
using...
分类:
其他好文 时间:
2015-01-29 12:47:43
阅读次数:
196
一、Credits属性说明严格来讲,Credits并不算版权信息,官方的说法是:Highchart by default putsa credits label in the lower right corner of the chart。不管怎样的说法,在自己的图表加上HighCharts字样并有...
分类:
其他好文 时间:
2015-01-27 17:50:00
阅读次数:
167