Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix smells
  • Loading branch information
ThanhNIT committed May 31, 2022
commit 18e4530ac72c51e854b9180212e8d8ff6aa9cff7
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ public class Solution {
public int maximumDetonation(int[][] bombs) {
int n = bombs.length;
List<Integer>[] graph = new List[n];
for (int i = 0; i < n; i++) graph[i] = new ArrayList<>();
for (int i = 0; i < n; i++) {
graph[i] = new ArrayList<>();
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
double dx = bombs[i][0] - bombs[j][0];
double dy = bombs[i][1] - bombs[j][1];
double r1 = bombs[i][2], r2 = bombs[j][2];
double dx = bombs[i][0] - (double) bombs[j][0];
double dy = bombs[i][1] - (double) bombs[j][1];
double r1 = bombs[i][2];
double r2 = bombs[j][2];
double dist = dx * dx + dy * dy;
if (dist <= r1 * r1) {
graph[i].add(j);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public int getScore() {

public SORTracker() {
tSet1 =
new TreeSet<Location>(
new TreeSet<>(
(a, b) -> {
if (a.score != b.score) {
return b.getScore() - a.getScore();
Expand All @@ -39,7 +39,7 @@ public SORTracker() {
});

tSet2 =
new TreeSet<Location>(
new TreeSet<>(
(a, b) -> {
if (a.score != b.score) {
return b.getScore() - a.getScore();
Expand Down