Run Code
|
API
|
Code Wall
|
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
Top view of a Binary tree
Graph DFS
¡Arriba, Papalotes, Arriba! v2
Search in a rotated sorted array two methods
Hello world!
std::string(pid_t)
sysFork3
string iteration performance
decrypt_problem_5
Subprime Fibonacci Sequence