Skip to content

Commit cd5db81

Browse files
committed
rising coder barebone, code need improvement and many are incomplete
1 parent 30ed279 commit cd5db81

14 files changed

+163
-1
lines changed

Lockout_v2/Problem_Statement/ProblemStatement.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<a href="https://www.hackerrank.com/contests/lockout-v2-pec-acm/challenges">
22
<h1 style="color: #5cafff">
3-
<img style="float: left" src="./../../asset/acm_logo.png" width=80>
3+
<img style="float: left" src="./../../asset/cp.webp" width=80>
44
<p align="center">
55
Lockout v2
66
</p>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int* a;
5+
6+
int main()
7+
{
8+
int n;
9+
cin >> n;
10+
11+
a = new int[n];
12+
13+
for (int i = 0; i < 10; i++)
14+
a[i] = i + 1;
15+
for (int i = 0; i < 10; i++)
16+
cout << a[i] << " \n";
17+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
a = [int(x) for x in input().split()]
2+
print(a)

RisingCodersChallenge_v1/B_IsItACM.cpp

Whitespace-only changes.

RisingCodersChallenge_v1/B_IsItACM.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
t = int(input())
2+
for testcase in range(t):
3+
s = input()
4+
A, C, M = 0, 0, 0
5+
for i in range(len(s)):
6+
if s[i] == 'A':
7+
A += 1
8+
if s[i] == 'C':
9+
C += 1
10+
if s[i] == 'M':
11+
M += 1
12+
13+
if A == 1 and C == 1 and M == 1:
14+
print("ACM")
15+
else:
16+
print("NOPE")
17+
18+
if 'A' in s and 'C' in s and 'M' in s:
19+
print("ACM")
20+
else:
21+
print("NOPE")
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
void solve()
6+
{
7+
int n, m;
8+
cin >> n >> m;
9+
10+
vector<int> alice(m), bob(m);
11+
for (int i = 0; i < m; i++)
12+
cin >> alice[i];
13+
for (int i = 0; i < m; i++)
14+
cin >> bob[i];
15+
16+
int score = 0;
17+
for (int i = 0; i < m; i++)
18+
score += alice[i] - bob[i];
19+
20+
if (score + n - m > 0)
21+
cout << "YES\n";
22+
else
23+
cout << "NO\n";
24+
}
25+
26+
int main()
27+
{
28+
int t;
29+
cin >> t;
30+
31+
for (int i = 0; i < t; i++)
32+
solve();
33+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
for _ in range(int(input())):
2+
n, m = [int(x) for x in input().split()]
3+
alice = [int(x) for x in input().split()]
4+
bob = [int(x) for x in input().split()]
5+
6+
score = n - m
7+
for i in range(len(alice)):
8+
score += alice[i]
9+
score -= bob[i]
10+
11+
if score > 0:
12+
print("YES")
13+
else:
14+
print("NO")

RisingCodersChallenge_v1/D_AlienDictionary.cpp

Whitespace-only changes.

RisingCodersChallenge_v1/D_AlienDictionary.py

Whitespace-only changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
int n;
7+
cin >> n;
8+
9+
std::vector<std::vector<int>> phones(n);
10+
for (int i = 0; i < n; i++)
11+
{
12+
int price, value;
13+
cin >> price >> value;
14+
phones[i] = {price, value};
15+
}
16+
17+
sort(phones.begin(), phones.end());
18+
for (int i = 0; i < n - 1; i++)
19+
{
20+
// (i, i + 1) compare ho raha hai
21+
// i = n - 1 hua toh i + 1 = n ho jaayega
22+
// index out of bound
23+
if (phones[i][0] < phones[i + 1][0]
24+
and phones[i][1] > phones[i + 1][1])
25+
{
26+
cout << "NEW PHONE";
27+
return 0;
28+
}
29+
}
30+
31+
cout << "OLD IT IS";
32+
}

0 commit comments

Comments
 (0)