//poj 1154
//sep9
#include
using namespace std;
const int maxR=32;
char a[maxR][maxR];
int r,s;
int ans=1;
int vis[200];
void dfs(int i,int j,int len)
{
ans=max(ans,len+1);
if(i+1<r&&vis[a[i+1][j]]...
分类:
其他好文 时间:
2015-05-12 01:45:19
阅读次数:
148
Implement Trie (Prefix Tree)
Implement a trie with insert, search,
and startsWith methods.
Note:
You may assume that all inputs are consist of lowercase letters a-z.
解题思路:
前缀树。由于值设定为在a-...
分类:
其他好文 时间:
2015-05-11 14:45:37
阅读次数:
116
题目:输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。#includeint main(void){ char c; int letters = 0, space = 0, digit = 0, others = 0; while ((c=getchar())...
分类:
编程语言 时间:
2015-05-11 14:24:51
阅读次数:
103
Longest Substring Without Repeating Characters Total Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters...
分类:
其他好文 时间:
2015-05-10 17:24:44
阅读次数:
145
Problem:
Given a digit string, return all possible letter combinations that the number could represent.
A mapping of digit to letters (just like on the telephone buttons) is given below.
...
分类:
编程语言 时间:
2015-05-10 14:18:54
阅读次数:
159
Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjace...
分类:
其他好文 时间:
2015-05-09 06:30:14
阅读次数:
100
https://leetcode.com/problems/decode-ways/A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...
分类:
其他好文 时间:
2015-05-09 01:10:52
阅读次数:
103
Implement a trie with insert, search, and startsWith methods.Note:
You may assume that all inputs are consist of lowercase letters a-z.思路:
之前也没有接触过Trie,百科上查了一下,大概就是词源的问题,N个word有公共前缀,只是后缀不同,可以用树表示。
可...
分类:
其他好文 时间:
2015-05-08 22:05:17
阅读次数:
158
【题目】
Given a digit string, return all possible letter combinations that the number could represent.
A mapping of digit to letters (just like on the telephone buttons) is given below....
分类:
其他好文 时间:
2015-05-08 09:29:30
阅读次数:
121
Word SearchGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, wh...
分类:
其他好文 时间:
2015-05-07 14:17:13
阅读次数:
106