Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
max_recursion
//g++ 5.4.0 #include <bits/stdc++.h> using namespace std; int max (int a[],int n) { cout<<1<<endl; if(n==0) { return a[0]; } int temp=max(a,n-1); if(a[n]>temp) { cout<<2<<endl; return (a[n]); } else { return temp; } } int main() { int t,i,n,a[100009],r; cin>>t; while(t--) { cin>>n; for(i=0;i<n;i++) { cin>>a[i]; } r=max(a,n-1); cout<<r<<endl; } }
run
|
edit
|
history
|
help
0
Microsoft - MaxEmployeeAttendence (R repititions - DP solution bitmask)
QP
Hello World - verbose
Sieve of Eratosthenes
exception
code
Hello World
dijkstra
HashFold
dijkstra's algo