Professional Documents
Culture Documents
20BET1071 - CC - Worksheet Exp-3.3
20BET1071 - CC - Worksheet Exp-3.3
INDEX
1.1 Arrays
1.2
Stacks and Queues
2.1 Graphs
2.2
Trees
2.3 Strings
3.2 Backtracking
Experiment – 3.3
Student Name: Anant Kumar Mathur UID: 20BET1071
Branch: IT Section/Group: 20BET-WM-601(B)
Semester: 5th Date of Performance: 07-11-2022
Subject Name: Competitive Coding Lab Subject Code: 20ITP-314
Question 1.
1. Aim:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
2. Code:-
#include <bits/stdc++.h>
using namespace std;
/*
* Complete the 'marcsCakewalk' function below.
*
* The function is expected to return a LONG_INTEGER.
* The function accepts INTEGER_ARRAY calorie as parameter.
*/
int main()
{
ofstream fout(getenv("OUTPUT_PATH"));
string n_temp;
getline(cin, n_temp);
int n = stoi(ltrim(rtrim(n_temp)));
string calorie_temp_temp;
getline(cin, calorie_temp_temp);
vector<int> calorie(n);
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
calorie[i] = calorie_item;
}
fout.close();
return 0;
}
s.erase(
s.begin(),
find_if(s.begin(), s.end(), not1(ptr_fun<int, int>(isspace)))
);
return s;
}
s.erase(
find_if(s.rbegin(), s.rend(), not1(ptr_fun<int, int>(isspace))).base(),
s.end()
);
return s;
}
string::size_type start = 0;
string::size_type end = 0;
start = end + 1;
}
tokens.push_back(str.substr(start));
return tokens;
}
3. OUTPUT:-
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Question -2
1. Aim:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
2. Code:
#include <bits/stdc++.h>
using namespace std;
/*
* Complete the 'gridChallenge' function below.
*
* The function is expected to return a STRING.
* The function accepts STRING_ARRAY grid as parameter.
*/
}
return "YES";
}
int main()
{
ofstream fout(getenv("OUTPUT_PATH"));
string t_temp;
getline(cin, t_temp);
int t = stoi(ltrim(rtrim(t_temp)));
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
int n = stoi(ltrim(rtrim(n_temp)));
vector<string> grid(n);
grid[i] = grid_item;
}
fout.close();
return 0;
}
s.erase(
s.begin(),
find_if(s.begin(), s.end(), not1(ptr_fun<int, int>(isspace)))
);
return s;
}
s.erase(
find_if(s.rbegin(), s.rend(), not1(ptr_fun<int, int>(isspace))).base(),
s.end()
);
return s;
}
3. OUTPUT :
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Learning Outcomes:-
1. To become good competitive programmer.
2. By doing coding question on hacker rank it increases problem solving
skills.
3. Learnt the use of Strings in DSA.
4. Competitive coding increases our technical skills.
5. We will be able to solve real world problem based questions
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING