File tree Expand file tree Collapse file tree 2 files changed +19
-15
lines changed
exercises/practice/queen-attack/.approaches Expand file tree Collapse file tree 2 files changed +19
-15
lines changed Original file line number Diff line number Diff line change 11{
2- "introduction" : {
2+ "introduction" : {
3+ "authors" : [
4+ " jagdish-15"
5+ ]
6+ },
7+ "approaches" : [
8+ {
9+ "uuid" : " b2e474c8-b778-41e7-83c0-8e41cc84af9e" ,
10+ "slug" : " simple-comparison" ,
11+ "title" : " Simple Comparison Approach" ,
12+ "blurb" : " Use basic comparison checks to determine if queens can attack each other." ,
313 "authors" : [
414 " jagdish-15"
515 ]
6- },
7- "approaches" : [
8- {
9- "uuid" : " " ,
10- "slug" : " simple-comparison" ,
11- "title" : " Simple Comparison Approach" ,
12- "blurb" : " Use basic comparison checks to determine if queens can attack each other." ,
13- "authors" : [
14- " jagdish-15"
15- ]
16- }
17- ]
18- }
19-
16+ }
17+ ]
18+ }
Original file line number Diff line number Diff line change 1+ boolean canQueensAttackOneAnother() {
2+ int rowDifference = Math.abs(queen1.getRow() - queen2.getRow());
3+ int columnDifference = Math.abs(queen1.getColumn() - queen2.getColumn());
4+ return rowDifference == 0 || columnDifference == 0 || rowDifference == columnDifference;
5+ }
You can’t perform that action at this time.
0 commit comments