Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Big O Notation array problem
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#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; }
g++
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
edit mode
|
history
|
discussion