Skip to content

Commit

Permalink
Final
Browse files Browse the repository at this point in the history
  • Loading branch information
NiharRanjan53 committed Sep 30, 2022
0 parents commit 46fad39
Show file tree
Hide file tree
Showing 21 changed files with 378 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Calc_earth.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include<bits/stdc++.h>
using namespace std;
int calculate_earth_minutes(int minutes, int second){
int earthTime = 0;

int totalSec = minutes * second;

return ceil((float)totalSec/60);

//return earthTime;

}
int main(){

cout << calculate_earth_minutes(1000, 20);

return 0;
}
Binary file added Calc_earth.exe
Binary file not shown.
30 changes: 30 additions & 0 deletions MissionAgent_Y.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include<bits/stdc++.h>
using namespace std;
int GetBuildingCount(int n, string s){
set<char> row,col;
int pos = 0;

for(int i = 0;i < s.size(); i++){
char ch = s[i];
if(ch != '{' && ch != ',' && ch != '}'){
if(pos == 0){
row.insert(ch);
}
else{
col.insert(ch);
}
pos = (pos+1)%2;

}

}
return ((row.size() + col.size()) * 8 - n);
}
int main(){
int n; cin >> n;
string s; cin >> s;

cout << GetBuildingCount(n, s);

return 0;
}
Binary file added MissionAgent_Y.exe
Binary file not shown.
42 changes: 42 additions & 0 deletions Nagarro_Capitalize_first_letter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include<bits/stdc++.h>
using namespace std;
string solve(string s, unordered_set<string> list){

for(int i = 0; i < s.size(); i++){
int j = i;
while(j < s.size() && s[j] != ' '){
j++;
}
if(list.find(s.substr(i, j-i)) != list.end()){

s[i] = toupper(s[i]);

}

i = j;

}

return s;

}
int main(){

unordered_set<string>list;
int n; cin >> n;
for(int i = 0 ; i < n ;i++){
string temp; cin >> temp;
list.insert(temp);
}

string s;
//cin >> s;
getline(cin, s);



cout << solve(s, list);
//cout << s;

return 0;
}
Binary file added Nagarro_Capitalize_first_letter.exe
Binary file not shown.
19 changes: 19 additions & 0 deletions Q29.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<html>
<head>
<style>
div{
padding: 10px;
margin: 10px;
height: 10px;
width: 10px;
background-color : black ;
}
</style>
</head>
<body>
<div></div>
<script>
console.log(document.getElementsByTagName('div')[0].clientHeight);
</script>
</body>
</html>
17 changes: 17 additions & 0 deletions Q39.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div class="div1">
<div class="div2"></div>
</div>
<style>
.div1{
position: relative;
width: 200px;
height: 200px;
border: 2px solid black;
}
.div2{
position: absolute;
bottom: 0;
right: 0;
border: 2px solid black;
}
</style>
42 changes: 42 additions & 0 deletions Untitled2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include<stdio.h>
#include<string.h>
#include<iostream>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
struct Result {
Result() : output1() {};
int output1[100];
};

Result placement(int input, int input2[]) {
//vector<int> r(input);
struct Result res;

for (int i = input - 1; i >= 0; i--) {
int cnt = 0;
for (int j = i - 1; j >= 0; j--) {
if (input2[j] > input2[i])
cnt++;
}
res.output1[i] = cnt;
}
return res;
}



int main() {
int n; cin >> n;
int input2[n];
for (int i = 0; i < n; i++)
cin >> input2[i];

struct Result res = placement(n, input2);

for (int i = 0;i < n;i++) {
cout << res.output1[i] << " ";
}

return 0;
}
Binary file added Untitled2.exe
Binary file not shown.
38 changes: 38 additions & 0 deletions duplicate_array.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include<iostream>
#include<vector>
#include<unordered_map>
using namespace std;
struct Result {
Result() : output1() {};
int output1[100];
};
Result duplicatearrya(int input, int input1[]) {
unordered_map<int, int> mp;
Result res;
for (int i = 0; i < input; i++) {
mp[input1[i]]++;
}
int j = 0;
for (auto &it : mp) {
if (it.second > 1) {
res.output1[j++] = it.first;
}
}
return res;
}

int main() {
int input;
cin >> input;
int input1[input];
for (int i = 0; i < input; i++) {
cin >> input1[i];
}
Result res = duplicatearrya(input, input1);

for (int i = 0; i< input;i++) {
cout << res.output1[i] << " ";
}

return 0;
}
Binary file added duplicate_array.exe
Binary file not shown.
26 changes: 26 additions & 0 deletions maq_struct.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include<bits/stdc++.h>
using namespace std;

struct Result
{
Result() : output1(){};
int output1[100];
};

Result DuplicateArray(int input1, input2[]){

for(int i = )

}
int main(){
int n; cin >> n;
int input2[n];

for(int i =0;i < n;i++){

}


return 0;
}

30 changes: 30 additions & 0 deletions minsteps.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include<bits/stdc++.h>
using namespace std;
int solve(int i, int j, int n, int m, vector<vector<int> > &dp)
{
if (i == n && j == m)
{
return 0;
}
if (i > n || j > m)
return 1e9;
if (dp[i][j] != -1)
return dp[i][j];
return dp[i][j] = 1 + min(solve(i, j + i, n, m, dp), solve(i + j, j, n, m, dp));
}
int minSteps(int input1, int input2)
{
vector<vector<int> > dp(input1 + 1, vector<int>(input2 + 1, -1));
return solve(1, 1, input1, input2, dp);
}
int main()
{
int n, m;
cin >> n >> m;
int ans = minSteps(n, m);
if (ans >= 1e9)
cout << -1;
else
cout << ans;
return 0;
}
40 changes: 40 additions & 0 deletions new.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include<stdio.h>
#include<string.h>
#include<iostream>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
struct Result {
Result() : output1() {};
int output1[100];
};

Result placement(int input, int input2[]) {
Result result ;
for (int i = input - 1; i >= 0; i--) {
int cnt = 0;
for (int j = i - 1; j >= 0; j--) {
if (input2[j] > input2[i])
cnt++;
}
result.output1[i] = cnt;
}
return result;
}



int main() {
int n; cin >> n;
int input2[n];
for (int i = 0; i < n; i++)
cin >> input2[i];

Result res = placement(n, input2);

for (int i = 0; i< n;i++) {
cout << res.output1[i] << " ";
}

return 0;
}
Binary file added new.exe
Binary file not shown.
28 changes: 28 additions & 0 deletions searching_sorting.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include<iostream>
using namespace std;
void linearSearch(){

}
int recursiveLinearSearch(int arr[], int n, int key){
if(n == 0){
return -1;
}

if(arr[n-1] == key){
return n-1;
}

else{
return recursiveLinearSearch(arr, n-1, key);
}
}
int main(){

int arr[] = {5, 6, 7, 8, 3};
cout << recursiveLinearSearch(arr, 5, 9);



return 0;

}
Binary file added searching_sorting.exe
Binary file not shown.
8 changes: 8 additions & 0 deletions solve.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include<stdio.h>
int main(){
int i = (1, 2, 3);
printf("%d", i);


return 0;
}
Binary file added solve.exe
Binary file not shown.
40 changes: 40 additions & 0 deletions structure.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include<stdio.h>
#include<string.h>
#include<iostream>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
struct Result {
Result() : output1() {};
int output1[100];
};

vector<int> placement(int input, int input2[]) {
vector<int> r(input);
for (int i = input - 1; i >= 0; i--) {
int cnt = 0;
for (int j = i - 1; j >= 0; j--) {
if (input2[j] > input2[i])
cnt++;
}
r[i] = cnt;
}
return r;
}



int main() {
int n; cin >> n;
int input2[n];
for (int i = 0; i < n; i++)
cin >> input2[i];

vector<int> v = placement(n, input2);

for (auto it : v) {
cout << it << " ";
}

return 0;
}

0 comments on commit 46fad39

Please sign in to comment.