Skip to content

Commit

Permalink
fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
vishal authored and vishal committed Jul 25, 2024
1 parent 2ff4dd5 commit f469346
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ yarn-error.log*
.DS_Store
*.pem

/ops/judge-ops/kcj-kubeconfig.yaml
/ops/judge-ops/kcj-kubeconfig.yaml
apps/boilerplate-generator/tempCodeRunnerFile.js
46 changes: 25 additions & 21 deletions apps/boilerplate-generator/tempCodeRunnerFile.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
[
{
"input": 0,
"output": 32
},
{
"input": -40,
"output": -40
},
{
"input": 100,
"output": 212
},
{
"input": 37,
"output": 98.6
},
{
"input": -17.78,
"output": 0
function intersect(A) {
function gcd(a, b) {
while (b) {
[a, b] = [b, a % b];
}
return a;
}
]

let g = A[0];
for (let i = 1; i < A.length; i++) {
g = gcd(g, A[i]);
if (g === 1) {
break;
}
}

return g === 1 ? "Yes" : "No";
}


const input = require('fs').readFileSync('/Users/vishal/Desktop/PROJECTS/algoearth/apps/problems/Intersting-Arrays/tests/inputs/5.txt', 'utf8').trim().split('\n').join(' ').split(' ');
const size_A = parseInt(input.shift());
const A = input.splice(0, size_A).map(Number);
const result = intersect(A);
console.log(result);

2 changes: 1 addition & 1 deletion apps/problems/Intersting-Arrays/tests/outputs/3.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Yes
No
2 changes: 1 addition & 1 deletion apps/problems/Intersting-Arrays/tests/outputs/5.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
No
Yes

0 comments on commit f469346

Please sign in to comment.