首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

微软面试题解决办法

2012-01-23 
微软面试题Question2:Time-1hourYouworkatacompanythatworksforinternet-relatedtechnologiesbasedproduct

微软面试题
Question   2   :   Time   -   1   hour     You   work   at   a   company   that   works   for   internet-related   technologies   based   products,   and   your   current   project   is   a   spam   filter.   This   filter   determines   whether   or   not   a   string   contains   spam-like   information   using   a   "spam-words-dictionary "   (SWD).   If   an   input   string   contains   at   least   one   word   from   this   dictionary   as   a   substring,   the   filter   considers   it   to   be   spam-suspicious.   (Note:   an   entire   string   is   considered   a   substring   of   itself.)     You 've   decided   to   solve   a   more   challenging   problem:   how   many   unique   strings   of   length   n,   composed   entirely   of   lowercase   letters,   are   spam-suspicious   for   a   given   SWD?   You   are   given   a   String[]   dictionary,   each   element   of   which   is   a   word   from   the   SWD,   and   an   int   n.   Return   the   answer   modulo   10000.
Definition
Class:SuspiciousStrings
Method:getAmount
Parameters:String[],   int
Returns:int
Method   signature:int   getAmount(String[]   dictionary,   int   n)
(be   sure   your   methodis   public)
Notes
"Substring "   is   formed   of   consecutive   letters   (so,   it 's   NOT   a   subsequence   of   letters).
"x   modulo   y "   means   the   remainder   of   x   divided   by   y.
Constraints
dictionary   will   contain   between   1   and   10   elements,   inclusive.
Each   element   of   dictionary   will   contatin   only   lowercase   letters   ( 'a '- 'z ').
Each   element   of   dictionary   will   contain   between   1   and   10   characters,   inclusive.
n   will   be   between   1   and   2147483647,   inclusive.
大家研究研究

[解决办法]
靠,比高考英语阅读还难~~~
[解决办法]
MS 考 Java?
[解决办法]
英语是难关.....哎!
[解决办法]
Does class suspicious string contain an array of strings to analyze?
[解决办法]
难度不大,对Pattern数组进行匹配即可,每个Pattern根据spam-words-dictionary分别定义。
更好的方法是提取spam-words-dictionary,组合成更少的匹配模式,再匹配。

热点排行