Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Big O Notation array problem
#include<bits/stdc++.h> using namespace std; int main() { vector<int> a; int n,k,t; bool flag=false; cin>>n; a.resize(n); for(int i=0;i<n;i++) { cin>>a[i]; } cin>>k>>t; for(int i=0;i<n;i++) { for(int j=i+1;j<n;j++) { if(abs(a[i]-a[j]) <= t && abs(i-j) <= k) { flag=true; break; } } } if(flag) { cout<<"true"; } else { cout<<"false"; } return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
infections.cpp
list
MeanSDVar
Discounting Future Stream
find-missing-number-arithmetic-progression
Matrix Multiplication Using Threads
Microsoft - MaxEmployeeAttendence (R repititions - 1st step towards DP.)
BinTreeInsert
BindWithContainer
Elevator 3
Please log in to post a comment.