Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,32 +1,32 @@
|
|||
; Generate 10 strings with equal left and right brackets
|
||||
Loop, 5
|
||||
{
|
||||
B = %A_Index%
|
||||
loop 2
|
||||
{
|
||||
String =
|
||||
Loop % B
|
||||
String .= "[`n"
|
||||
Loop % B
|
||||
String .= "]`n"
|
||||
Sort, String, Random
|
||||
StringReplace, String, String,`n,,All
|
||||
Example .= String " - " IsBalanced(String) "`n"
|
||||
}
|
||||
B = %A_Index%
|
||||
loop 2
|
||||
{
|
||||
String =
|
||||
Loop % B
|
||||
String .= "[`n"
|
||||
Loop % B
|
||||
String .= "]`n"
|
||||
Sort, String, Random
|
||||
StringReplace, String, String,`n,,All
|
||||
Example .= String " - " IsBalanced(String) "`n"
|
||||
}
|
||||
}
|
||||
MsgBox % Example
|
||||
MsgBox % Example
|
||||
return
|
||||
|
||||
IsBalanced(Str)
|
||||
{
|
||||
Loop, PARSE, Str
|
||||
{
|
||||
If A_LoopField = [
|
||||
i++
|
||||
Else if A_LoopField = ]
|
||||
i--
|
||||
If i < 0
|
||||
return "NOT OK"
|
||||
}
|
||||
Return "OK"
|
||||
Loop, PARSE, Str
|
||||
{
|
||||
If A_LoopField = [
|
||||
i++
|
||||
Else if A_LoopField = ]
|
||||
i--
|
||||
If i < 0
|
||||
return "NOT OK"
|
||||
}
|
||||
Return "OK"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
Loop, 5
|
||||
{
|
||||
B = %A_Index%
|
||||
loop 2
|
||||
{
|
||||
String =
|
||||
Loop % B
|
||||
String .= "[`n"
|
||||
Loop % B
|
||||
String .= "]`n"
|
||||
Sort, String, Random
|
||||
StringReplace, String, String,`n,,All
|
||||
Example .= String " - " IsBalanced(String) "`n"
|
||||
}
|
||||
B = %A_Index%
|
||||
loop 2
|
||||
{
|
||||
String =
|
||||
Loop % B
|
||||
String .= "[`n"
|
||||
Loop % B
|
||||
String .= "]`n"
|
||||
Sort, String, Random
|
||||
StringReplace, String, String,`n,,All
|
||||
Example .= String " - " IsBalanced(String) "`n"
|
||||
}
|
||||
}
|
||||
MsgBox % Example
|
||||
MsgBox % Example
|
||||
return
|
||||
|
||||
IsBalanced(Str){
|
||||
While (Instr(Str,"[]"))
|
||||
StringReplace, Str, Str,[],,All
|
||||
Return Str ? "False" : "True"
|
||||
While (Instr(Str,"[]"))
|
||||
StringReplace, Str, Str,[],,All
|
||||
Return Str ? "False" : "True"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue