Skip to content

Commit

Permalink
Q. NO. 2903
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamkasaudhan committed Oct 20, 2023
1 parent bdea152 commit ea29c10
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Q2903Leetcode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 2903. Find Indices With Index and Value Difference I
//tc o(n^2)
//sc O(1)
//code
class Solution {
public:
vector<int> findIndices(vector<int>& nums, int d, int v) {
for(int i =0; i<nums.size(); i++){
for(int j = i;j<nums.size(); j++){
if(abs(i-j)>=d && abs(nums[i]-nums[j])>=v){
return {i,j};
}
}
}
return {-1,-1};
}
};

0 comments on commit ea29c10

Please sign in to comment.