这是我的数据库结构
{
"_id" : ObjectId("576155226d1d298c2cc3edca"),
"questionLibrary" : {
"technologyName" : "CSS",
"questions" : [
{
"correctanswer" : {
"A1" : "CSS1"
},
"answeroption" : {
"A4" : "CSS1",
"A3" : "CSS1",
"A2" : "CSS1",
"A1" : "CSS1"
},
"level" : "Amature",
"tags" : "CSS",
"question" : "CSS1"
},
{
"question" : "CSS2",
"tags" : "CSS",
"answeroption" : {
"A1" : "CSS2",
"A2" : "CSS2",
"A3" : "CSS2",
"A4" : "CSS2"
},
"level" : "Amature",
"correctanswer" : {
"A1" : "CSS2" …Run Code Online (Sandbox Code Playgroud) 现在可用的解决方案是每个地方都有一个include和exclude sum 。在max这两个结束时会给我输出。
现在最初我很难理解这个算法,我想为什么不以简单的方式进行。
算法:通过一次增加两个数组指针来循环数组
sumsum最后,拿max这两个sum。
那样的话,我认为复杂度会减半 O(n/2)
这个算法正确吗?
我无法区分TDD和BDD.有人能给出一个简单的例子来说明使用jasmine在javascript上下文中的区别吗?