我有一项任务是从列表中搜索字母(20×20 <= MxN <= 1000×1000)单词(5 <= length <= 100)的网格.隐藏在网格中的任何单词总是呈Z字形段的形式,其长度可能只有2或3.之字形段只能是从左到右或从下到上.
所需的复杂性等于网格中字母数和列表中字母数的乘积.
对于网格:
••••••••••••••••••••
••••••••ate•••••x•••
•••••••er•••••••e•••
••••••it••••••••v•••
••••ell••••••a••f•••
•••at••••e••••••rbg•
•••s•••••••ga•••••••
Run Code Online (Sandbox Code Playgroud)
和{"forward", "iterate", "phone", "satellite"}
输出的单词列表将是
3,6,iterate
6,3,satellite
Run Code Online (Sandbox Code Playgroud)
我这样做了C++:
我在前缀/单词的unordered_map<string, int>where中保存了所有前缀和单词,key前缀value为1,单词为2.现在我做这样的事情(伪代码):
for (char c in grid)
check(c + "");
}
Run Code Online (Sandbox Code Playgroud)
哪里:
check(string s) {
if s is key in unsorted_map {
if (value[s] == 2) //it's a word
print s; //and position
if (not up 3 time consecutive) //limit the …Run Code Online (Sandbox Code Playgroud) I was trying to run sqlmap with method POST but I got this error:
[CRITICAL] no parameter(s) found for testing in the provided data (e.g. GET parameter 'id' in 'www.site.com/index.php?id=1')
Now, I know that for POST method I must run sqlmap with data flag (e.g --data="name=value")
but my form input data has no name and data is send as a string.
How can I use sqlmap in this situation?
在 Objective-C 中,相当于List<Products> cartProduct = new ArrayList();. 我使用 NSMutableArray 但这与 Java ArrayList 不同。
我试图用gcc优化C代码.如果我使用-O1选项将有更好的运行时间,但如果我使用等效
-fauto-inc-dec
-fcompare-elim
-fcprop-registers
-fdce
-fdefer-pop
-fdelayed-branch
-fdse
-fguess-branch-probability
-fif-conversion2
-fif-conversion
-fipa-pure-const
-fipa-profile
-fipa-reference
-fmerge-constants
-fsplit-wide-types
-ftree-bit-ccp
-ftree-builtin-call-dce
-ftree-ccp
-ftree-ch
-ftree-copyrename
-ftree-dce
-ftree-dominator-opts
-ftree-dse
-ftree-forwprop
-ftree-fre
-ftree-phiprop
-ftree-slsr
-ftree-sra
-ftree-pta
-ftree-ter
-funit-at-a-time
Run Code Online (Sandbox Code Playgroud)
它就像我没有使用任何选项标志.GCC版本是4.8.2.拜托,谁能解释一下为什么?我刚刚发现这些标志的顺序很重要,但我没有找到-O1中的顺序.