Skip to content

Commit 1eedca0

Browse files
authored
Update Maximum Number of Points From Grid Queries.cpp
1 parent 561c4af commit 1eedca0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Arrays/2-D Array/Maximum Number of Points From Grid Queries.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Solution {
103103

104104

105105
//Approach-3 (Optimal Approach using sorting and min-heap)
106-
//T.C : O(QlogQ + m*nlog(m*n)) - Notice that we won't visit any cell more than once. Total cells = m*n and heap can have m*n cells in worst case
106+
//T.C : O(QlogQ + m*nlog(m*n)) - Notice that we won't visit any cell more than once (we mark them visited). Total cells = m*n and heap can have m*n cells in worst case
107107
//S.C : O(m*n)
108108
class Solution {
109109
public:
@@ -256,7 +256,7 @@ class SolutionDFS {
256256

257257

258258
// Approach-3 (Optimal Approach using sorting and min-heap)
259-
// T.C : O(QlogQ + m*nlog(m*n))
259+
// T.C : O(QlogQ + m*nlog(m*n)) - Notice that we won't visit any cell more than once (we mark them visited). Total cells = m*n and heap can have m*n cells in worst case
260260
// S.C : O(m*n)
261261
class SolutionOptimal {
262262
int[][] directions = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};

0 commit comments

Comments
 (0)