Skip to content

Commit 2eb6d3a

Browse files
Finding maximum value of an array fixed
1 parent 2990cb0 commit 2eb6d3a

7 files changed

+31
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"K. Max and Min","group":"Codeforces - Sheet #1 (Data type - Conditions)","url":"https://codeforces.com/group/MWSDmqGsZm/contest/219158/problem/K","interactive":false,"memoryLimit":64,"timeLimit":250,"tests":[{"input":"1 2 3\n","output":"1 3\n","id":1718700110133},{"input":"-1 -2 -3\n","output":"-3 -1\n","id":1718700110132},{"id":1718700110092,"input":"10 20 -5\n","output":"-5 20\n"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"KMaxAndMin"}},"batch":{"id":"2799c0fe-21b0-4ddb-be76-1e388dadeade","size":1},"srcPath":"f:\\Tutorials\\Video Tutorials\\Phitron\\2. Introduction to C++\\K_Max_and_Min.cpp"}

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.associations": {
3+
"iostream": "cpp"
4+
}
5+
}

E_Max.bin

50.3 KB
Binary file not shown.

E_Max.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
int n;
7+
cin >> n;
8+
long long int a[n];
9+
for (int i = 0; i < n; i++)
10+
{
11+
cin >> a[i];
12+
}
13+
14+
long long int mx = 0;
15+
16+
for (int i = 0; i < n; i++)
17+
{
18+
mx = max(mx, a[i]);
19+
}
20+
21+
cout << mx << endl;
22+
23+
return 0;
24+
}

E_Max.exe

49.9 KB
Binary file not shown.

K_Max_and_Min.cpp

Whitespace-only changes.

output.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1 2 2 5 7
1+
2

0 commit comments

Comments
 (0)