http://haixiaoyang.wordpress.com/category/dynamic-programming/
/*
get all possibilities of letter combinations
a->1, b->2, ...., z->26
so for "112" it returns 3, which are
1,1,2 => aab
11,2 => kb
1,12 => al
*/
int _inner_ways(const char* pStr)
{
if (*pStr == 0)
return 1;
if (*pStr <= '0' || *pStr > '9')
return 0;
int n = _inner_ways(pStr+1);
if ((*pStr == '1' && *(pStr + 1) >= '0' && *(pStr + 1) <= '9')
|| (*pStr == '2' &&am......
阅读全文