diff --git a/Calc_earth.cpp b/Calc_earth.cpp new file mode 100644 index 0000000..9f84e0f --- /dev/null +++ b/Calc_earth.cpp @@ -0,0 +1,18 @@ +#include +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; +} \ No newline at end of file diff --git a/Calc_earth.exe b/Calc_earth.exe new file mode 100644 index 0000000..e7a7e3e Binary files /dev/null and b/Calc_earth.exe differ diff --git a/MissionAgent_Y.cpp b/MissionAgent_Y.cpp new file mode 100644 index 0000000..26c4895 --- /dev/null +++ b/MissionAgent_Y.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; +int GetBuildingCount(int n, string s){ + set 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; +} \ No newline at end of file diff --git a/MissionAgent_Y.exe b/MissionAgent_Y.exe new file mode 100644 index 0000000..e5bb2bf Binary files /dev/null and b/MissionAgent_Y.exe differ diff --git a/Nagarro_Capitalize_first_letter.cpp b/Nagarro_Capitalize_first_letter.cpp new file mode 100644 index 0000000..033f79b --- /dev/null +++ b/Nagarro_Capitalize_first_letter.cpp @@ -0,0 +1,42 @@ +#include +using namespace std; +string solve(string s, unordered_set 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_setlist; + 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; +} \ No newline at end of file diff --git a/Nagarro_Capitalize_first_letter.exe b/Nagarro_Capitalize_first_letter.exe new file mode 100644 index 0000000..f9e4f34 Binary files /dev/null and b/Nagarro_Capitalize_first_letter.exe differ diff --git a/Q29.html b/Q29.html new file mode 100644 index 0000000..5f45a78 --- /dev/null +++ b/Q29.html @@ -0,0 +1,19 @@ + + + + + +
+ + + \ No newline at end of file diff --git a/Q39.html b/Q39.html new file mode 100644 index 0000000..6d91d49 --- /dev/null +++ b/Q39.html @@ -0,0 +1,17 @@ +
+
+
+ diff --git a/Untitled2.cpp b/Untitled2.cpp new file mode 100644 index 0000000..dd48218 --- /dev/null +++ b/Untitled2.cpp @@ -0,0 +1,42 @@ +#include +#include +#include +#include +#include +using namespace std; +struct Result { + Result() : output1() {}; + int output1[100]; +}; + +Result placement(int input, int input2[]) { + //vector 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; +} diff --git a/Untitled2.exe b/Untitled2.exe new file mode 100644 index 0000000..6258029 Binary files /dev/null and b/Untitled2.exe differ diff --git a/duplicate_array.cpp b/duplicate_array.cpp new file mode 100644 index 0000000..d672be3 --- /dev/null +++ b/duplicate_array.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +using namespace std; +struct Result { + Result() : output1() {}; + int output1[100]; +}; +Result duplicatearrya(int input, int input1[]) { + unordered_map 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; +} \ No newline at end of file diff --git a/duplicate_array.exe b/duplicate_array.exe new file mode 100644 index 0000000..c2841ed Binary files /dev/null and b/duplicate_array.exe differ diff --git a/maq_struct.cpp b/maq_struct.cpp new file mode 100644 index 0000000..d5cc5c2 --- /dev/null +++ b/maq_struct.cpp @@ -0,0 +1,26 @@ +#include +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; +} + diff --git a/minsteps.cpp b/minsteps.cpp new file mode 100644 index 0000000..b986307 --- /dev/null +++ b/minsteps.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; +int solve(int i, int j, int n, int m, vector > &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 > dp(input1 + 1, vector(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; +} \ No newline at end of file diff --git a/new.cpp b/new.cpp new file mode 100644 index 0000000..e2d1a43 --- /dev/null +++ b/new.cpp @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include +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; +} \ No newline at end of file diff --git a/new.exe b/new.exe new file mode 100644 index 0000000..510bb49 Binary files /dev/null and b/new.exe differ diff --git a/searching_sorting.cpp b/searching_sorting.cpp new file mode 100644 index 0000000..0211af2 --- /dev/null +++ b/searching_sorting.cpp @@ -0,0 +1,28 @@ +#include +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; + +} \ No newline at end of file diff --git a/searching_sorting.exe b/searching_sorting.exe new file mode 100644 index 0000000..42d2ae3 Binary files /dev/null and b/searching_sorting.exe differ diff --git a/solve.c b/solve.c new file mode 100644 index 0000000..65af64d --- /dev/null +++ b/solve.c @@ -0,0 +1,8 @@ +#include +int main(){ + int i = (1, 2, 3); + printf("%d", i); + + + return 0; +} diff --git a/solve.exe b/solve.exe new file mode 100644 index 0000000..3e4d0d4 Binary files /dev/null and b/solve.exe differ diff --git a/structure.c b/structure.c new file mode 100644 index 0000000..807aeee --- /dev/null +++ b/structure.c @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include +using namespace std; +struct Result { + Result() : output1() {}; + int output1[100]; +}; + +vector placement(int input, int input2[]) { + vector 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 v = placement(n, input2); + + for (auto it : v) { + cout << it << " "; + } + + return 0; +}