{"ScriptPreparationCode":"var a = [{\r\n subChallenges: [{\r\n state: \u0022ACCEPTED\u0022\r\n }, {\r\n state: false\r\n }, {\r\n state: \u0022ACCEPTED\u0022\r\n }]\r\n}, {\r\n subChallenges: [{\r\n state: \u0022ACCEPTED\u0022\r\n }, {\r\n state: false\r\n }, {\r\n state: false\r\n }]\r\n}, {\r\n subChallenges: [{\r\n state: \u0022ACCEPTED\u0022\r\n }, {\r\n state: false\r\n }, {\r\n state: false\r\n }]\r\n}, {\r\n subChallenges: [{\r\n state: \u0022ACCEPTED\u0022\r\n }, {\r\n state: \u0022ACCEPTED\u0022\r\n }, {\r\n state: \u0022ACCEPTED\u0022\r\n }]\r\n}]\r\n\r\nfunction Function_0(challenges) {\r\n let count = 0;\r\n if (challenges) {\r\n challenges.map((challenge) =\u003E {\r\n if (\r\n challenge.subChallenges \u0026\u0026\r\n challenge.subChallenges.filter(\r\n (subChallenge) =\u003E subChallenge.state !== \u0022ACCEPTED\u0022\r\n ).length === 0\r\n )\r\n count\u002B\u002B;\r\n });\r\n }\r\n return count;\r\n}\r\n\r\nfunction Function_1(challenges) {\r\n let count = 0;\r\n if (challenges) {\r\n let i = challenges.length;\r\n\r\n while (i--) {\r\n let challenge = challenges[i];\r\n\r\n if (!challenge.subChallenges) {\r\n continue;\r\n }\r\n\r\n let j = challenge.subChallenges.length,\r\n truthy = true;\r\n\r\n while (j--) {\r\n if (challenge.subChallenges.state !== \u0022ACCEPTED\u0022) {\r\n truthy = false;\r\n \tcontinue;\r\n }\r\n }\r\n\r\n if (truthy) {\r\n count\u002B\u002B\r\n }\r\n }\r\n }\r\n\r\n return count;\r\n}","TestCases":[{"Name":"Original","Code":"Function_0(a);","IsDeferred":false},{"Name":"Opti","Code":"Function_1(a);","IsDeferred":false}]}