Skip to content

Commit

Permalink
Time: 0 ms (100.00%), Space: 13.5 MB (24.36%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikhil0-3 committed Dec 1, 2024
1 parent f1ef951 commit 1784548
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Solution {
public:
bool checkIfExist(vector<int>& arr) {
// Step 1: Iterate through all pairs of indices
for (int i = 0; i < arr.size(); i++) {
for (int j = 0; j < arr.size(); j++) {
// Step 2: Check the conditions
if (i != j && arr[i] == 2 * arr[j]) {
return true;
}
}
}
// No valid pair found
return false;
}
};

0 comments on commit 1784548

Please sign in to comment.