Skip to content

Commit

Permalink
Adding uuid for approach of queen-attack exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
jagdish-15 committed Nov 14, 2024
1 parent db87438 commit e0f7eb5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
29 changes: 14 additions & 15 deletions exercises/practice/queen-attack/.approaches/config.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"introduction": {
"introduction": {
"authors": [
"jagdish-15"
]
},
"approaches": [
{
"uuid": "b2e474c8-b778-41e7-83c0-8e41cc84af9e",
"slug": "simple-comparison",
"title": "Simple Comparison Approach",
"blurb": "Use basic comparison checks to determine if queens can attack each other.",
"authors": [
"jagdish-15"
]
},
"approaches": [
{
"uuid": "",
"slug": "simple-comparison",
"title": "Simple Comparison Approach",
"blurb": "Use basic comparison checks to determine if queens can attack each other.",
"authors": [
"jagdish-15"
]
}
]
}

}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
boolean canQueensAttackOneAnother() {
int rowDifference = Math.abs(queen1.getRow() - queen2.getRow());
int columnDifference = Math.abs(queen1.getColumn() - queen2.getColumn());
return rowDifference == 0 || columnDifference == 0 || rowDifference == columnDifference;
}

0 comments on commit e0f7eb5

Please sign in to comment.