b*****u 发帖数: 648 | 1 int ValidWords ( char[][]matrix, int n, map dictionary)
{
int result = 0;
//every element as starting point
for(int i = 0; i< n; i++)
{
for (int j = 0; j
{
map usage;
string testWord;
testWord += matrix[i][j];
usage[i*n+j]=1;
moveNext (testWord; i, j, dictionary,usage,result);
}
}
return result;
}
// move to next step
void moveNext (string testWord, int i, int j, m... 阅读全帖 |
|