在网格中找到一个字符串 [英] find a string in a grid

查看:84
本文介绍了在网格中找到一个字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


这些是我在最近一次采访中遇到的一些MS问题。

希望它对你们中的一些人有所帮助。


#1。给定n X m个字符网格。你应该在这个迷宫中搜索

一个字符串。字符串中的字符不一定是直线排列的。他们只需要持有佐剂

positiong。


例如


如果这是一个迷宫


abdef

rnaju

gymrl

etiyu


字符串namit应该返回找到(真正的2,2 2,3 3,3 4,3 4,2他们

持有辅助职位)。

Hi guys,

These are some MS questions which i encountered in a recent interview.
Hope it''ll be helpfull to some of you.

#1. Given an n X m grid of characters. You are supposed to search for
a string with in this maze. The characters in the string need not be
alligned in a straight line. They just need to be holding adjusent
positiong.

eg

if this is a maze

a b d e f
r n a j u
g y m r l
e t i y u

The string namit should return a found(True "2,2 2,3 3,3 4,3 4,2" They
hold adjucent positions).

推荐答案

puzzlecracker写道:
puzzlecracker wrote:
大家好,

[方式OT编辑]
Hi guys,

[way OT redacted]




那太好了。你的C ++问题是?



That''s nice. And your C++ question was?


这很好。你的C ++问题是什么?
That''s nice. And your C++ question was?




用C ++回答它,真是一个愉快的冒险!



answer it in C++, what a gleeful venture!


puzzlecracker写道:


[...]
puzzlecracker wrote:

[ ... ]
用C ++回答它,这真是一个愉快的冒险!
answer it in C++, what a gleeful venture!



显然你会高兴地参加递归活动吗?


-

后来,

杰里。


宇宙是自己想象的虚构。



Apparently you take glee in recursion?

--
Later,
Jerry.

The universe is a figment of its own imagination.


这篇关于在网格中找到一个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆