TCS NQT 2026 SOLUTIONS
СтатистикаTCS NQT Resources will be uploaded here. Latest Jobs and Internships are regularly uploaded here - @placementlelo If you want any other exam answers for free : @exam_cheating_bot Collaborations: @growth_admin
- Последний пост
- 28 февр.
- Последнее чтение
- 13 авг.
- Постов за неделю
- 0
- Всего постов
- 21
- Тип
- открытый
- Язык
- английский
- В каталоге с
- 13 авг.
- 1/24сутки в ленте
- —
- 1/48двое суток
- —
- 1/72трое суток
- —
Оценка по просмотрам недавних постов: пост набирает почти всё за первые сутки.
Посты
TCS NQT Placement Resources 👇🏻 https://drive.google.com/drive/folders/1Hcg4Nv-plE4i-MysXDAlXBLE6tBXr6Ok TCS NQT Detailed Syllabus 👇🏻 https://drive.google.com/file/d/1AengePrk06O7RyFtEk_-WYxljVn87h-3/view TCS NQT Discussion Group 👇🏻 https://telegram.me/+PIVbtXnoJf5lOWQ1 TCS NQT 2026 Channel 👇🏻 https://telegram.me/+kKqtt46QMtU2MDJl TCS NQT Official Group 👇🏻 https://telegram.me/+oZ4x3k1RtXdkNWU1
TCS FREE NQT - Biggest Mass Hiring: Graduation Year: 2024 / 2025 / 2026 Eligibility: BTech / BE / MTech / ME / MCA / MSc / MS Salary: Ninja - 3.36 LPA Digital - 7 LPA Prime - 9 LPA for UG and 11.5 LPA for PG Location: PAN India Apply Link: https://www.tcs.com/careers/india/tcs-all-india-nqt-hiring Complete Application Process: https://youtu.be/YEjMevJe9wc Telegram: https://telegram.me/PLACEMENTLELO Registration End Date: 20 March 2026 Test Date: 10 March 2026 Onwards ✅ Share this with your friends 😇
Latest Off-Campus Jobs and Internships are Uploaded regularly here👇 1. https://telegram.me/PLACEMENTLELO 2. https://telegram.me/OFF_CAMPUS_JOBS_AND_INTERNSHIPS ✅ Must Join ✅
C++ Cable Wrap TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, M; cin >> N >> M; vector<string> grid(N); for (int i = 0; i < N; i++) { grid[i].resize(M); for (int j = 0; j < M; j++) { cin >> grid[i][j]; } } vector<int> horizontal_rods, vertical_rods; for (int i = 0; i < N; i++) { if (all_of(grid[i].begin(), grid[i].end(), [](char c){ return c != '.'; })) horizontal_rods.push_back(i); } for (int j = 0; j < M; j++) { bool full = true; for (int i = 0; i < N; i++) if (grid[i][j] == '.') full = false; if (full) vertical_rods.push_back(j); } vector<vector<bool>> is_cross(N, vector<bool>(M, false)); for (int c : vertical_rods) { for (int i = 0; i < N; i++) { int left = c - 1, right = c + 1; if (left >= 0 && right < M && grid[i][left] == 'C' && grid[i][right] == 'C') is_cross[i][c] = true; } } for (int r : horizontal_rods) { for (int j = 0; j < M; j++) { int up = r - 1, down = r + 1; if (up >= 0 && down < N && grid[up][j] == 'C' && grid[down][j] == 'C') is_cross[r][j] = true; } } vector<vector<bool>> cable(N, vector<bool>(M, false)); for (int i = 0; i < N; i++) for (int j = 0; j < M; j++) if (grid[i][j] == 'C' || is_cross[i][j]) cable[i][j] = true; vector<vector<int>> adj(N * M); int di[4] = {-1, 0, 1, 0}; int dj[4] = {0, 1, 0, -1}; for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { if (!cable[i][j]) continue; int id = i * M + j; for (int d = 0; d < 4; d++) { int ni = i + di[d], nj = j + dj[d]; if (ni >= 0 && ni < N && nj >= 0 && nj < M && cable[ni][nj]) adj[id].push_back(ni * M + nj); } } } int start = -1; for (int i = 0; i < N && start == -1; i++) for (int j = 0; j < M; j++) if (cable[i][j] && adj[i * M + j].size() == 1) { start = i * M + j; break; } vector<bool> visited(N * M, false); vector<int> sum_h(N, 0), sum_v(M, 0); int curr = start, prevv = -1; visited[curr] = true; while (true) { int cr = curr / M, cc = curr % M; int nextt = -1; for (int nb : adj[curr]) if (nb != prevv && !visited[nb]) { nextt = nb; break; } if (is_cross[cr][cc] && prevv != -1) { int pr = prevv / M, pc = prevv % M; int sign = (grid[cr][cc] == 'C') ? 1 : -1; if (pr == cr) sum_v[cc] += ((pc < cc) ? 1 : -1) * sign; else sum_h[cr] += ((pr < cr) ? 1 : -1) * sign; } if (nextt == -1) break; prevv = curr; curr = nextt; visited[curr] = true; } long long answer = 0; for (int r : horizontal_rods) answer += abs(sum_h[r]) / 2; for (int c : vertical_rods) answer += abs(sum_v[c]) / 2; cout << answer; return 0; } C++ Cable Wrap TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9
C++ Order It Code TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9 #include <bits/stdc++.h> using namespace std; static int min_ops(const vector<int>& a) { int n = (int)a.size(); string s(n, '\0'), g(n, '\0'); for (int i = 0; i < n; ++i) s[i] = char(a[i]); for (int i = 0; i < n; ++i) g[i] = char(i); if (s == g) return 0; vector<array<int,3>> mv; mv.reserve(n * n * n); for (int i = 0; i < n; ++i) { for (int j = i + 1; j <= n; ++j) { int ln = j - i; for (int k = 0; k <= n - ln; ++k) { if (k == i) continue; mv.push_back({i, j, k}); } } } deque<string> q1, q2; unordered_map<string,int> d1, d2; q1.push_back(s); d1.emplace(s, 0); q2.push_back(g); d2.emplace(g, 0); auto expand = [&](deque<string>& q, unordered_map<string,int>& dself, unordered_map<string,int>& dother) -> int { int m = (int)q.size(); while (m--) { string x = q.front(); q.pop_front(); int dx = dself[x]; for (auto &t : mv) { int i = t[0], j = t[1], k = t[2]; int ln = j - i; string b = x.substr(i, ln); string r = x.substr(0, i) + x.substr(j); string y = r.substr(0, k) + b + r.substr(k); if (dself.find(y) != dself.end()) continue; int nd = dx + 1; auto it = dother.find(y); if (it != dother.end()) return nd + it->second; dself.emplace(y, nd); q.push_back(y); } } return -1; }; while (!q1.empty() && !q2.empty()) { if (q1.size() <= q2.size()) { int ans = expand(q1, d1, d2); if (ans != -1) return ans; } else { int ans = expand(q2, d2, d1); if (ans != -1) return ans; } } return 0; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; if (!(cin >> n)) return 0; string line; getline(cin, line); // consume endline after n getline(cin, line); // blank line vector<string> sh(n), og(n); for (int i = 0; i < n; ++i) getline(cin, sh[i]); getline(cin, line); // blank line for (int i = 0; i < n; ++i) getline(cin, og[i]); unordered_map<string,int> mp; mp.reserve(n * 2); for (int i = 0; i < n; ++i) mp[og[i]] = i; vector<int> a(n); for (int i = 0; i < n; ++i) a[i] = mp[sh[i]]; cout << min_ops(a) << "\n"; return 0; } C++ Order It Code TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9
C++ Uno Code TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9 #include <bits/stdc++.h> using namespace std; int findp(int x, vector<int>& p) { return p[x] == x ? x : p[x] = findp(p[x], p); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<string> names(n); for (int i = 0; i < n; i++) cin >> names[i]; vector<int> skill(n); for (int i = 0; i < n; i++) cin >> skill[i]; unordered_map<string, int> id; for (int i = 0; i < n; i++) id[names[i]] = i; int f; cin >> f; vector<int> p(n); iota(p.begin(), p.end(), 0); for (int i = 0; i < f; i++) { string a, b; cin >> a >> b; int x = findp(id[a], p), y = findp(id[b], p); if (x != y) p[y] = x; } unordered_map<int, vector<int>> clusters; for (int i = 0; i < n; i++) clusters[findp(i, p)].push_back(i); vector<vector<int>> group; vector<int> groupSkill, groupSize; for (auto& [r, v] : clusters) { group.push_back(v); int s = 0; for (int x : v) s += skill[x]; groupSkill.push_back(s); groupSize.push_back(v.size()); } int r; cin >> r; int m = group.size(); vector<vector<int>> rival(m); unordered_map<int, int> idx; { int i = 0; for (auto& [root, _] : clusters) idx[root] = i++; } for (int i = 0; i < r; i++) { string a, b; cin >> a >> b; int ga = idx[findp(id[a], p)]; int gb = idx[findp(id[b], p)]; if (ga != gb) { rival[ga].push_back(gb); rival[gb].push_back(ga); } } int limit; cin >> limit; int best = 0; int total = 1 << m; for (int mask = 0; mask < total; mask++) { int sumSkill = 0, count = 0; bool valid = true; for (int i = 0; i < m && valid; i++) { if (mask & (1 << i)) { for (int x : rival[i]) { if (mask & (1 << x)) { valid = false; break; } } sumSkill += groupSkill[i]; if (sumSkill > limit) { valid = false; break; } count += groupSize[i]; } } if (valid) best = max(best, count); } cout << best; return 0; } C++ Uno Code TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9
C++ Shape Counts TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9 #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll,ll>; static vector<P> merge_itv(vector<P> v){ sort(v.begin(), v.end()); vector<P> r; for(auto &p: v){ if(r.empty() || p.first > r.back().second){ r.push_back(p); }else{ if(p.second > r.back().second) r.back().second = p.second; } } return r; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; if(!(cin >> n)) return 0; map<ll, vector<P>> hv; map<ll, vector<P>> vv; for(int i=0;i<n;i++){ ll x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2; if(y1 == y2){ if(x1 > x2) swap(x1,x2); hv[y1].push_back({x1,x2}); }else{ if(y1 > y2) swap(y1,y2); vv[x1].push_back({y1,y2}); } } struct H { ll y,l,r; }; vector<H> hs; for(auto &e: hv){ ll y = e.first; auto m = merge_itv(e.second); for(auto &q: m) hs.push_back({y, q.first, q.second}); } struct V { ll x,yb,yt; }; vector<V> vs; for(auto &e: vv){ ll x = e.first; auto m = merge_itv(e.second); for(auto &q: m) vs.push_back({x, q.first, q.second}); } int h = (int)hs.size(); int v = (int)vs.size(); int w = (h + 63) >> 6; vector<vector<unsigned long long>> msk(v, vector<unsigned long long>(w, 0ULL)); for(int i=0;i<v;i++){ ll x = vs[i].x, yb = vs[i].yb, yt = vs[i].yt; for(int j=0;j<h;j++){ const auto &hh = hs[j]; if(yb <= hh.y && hh.y <= yt && hh.l <= x && x <= hh.r){ int b = j >> 6, o = j & 63; msk[i][b] |= (1ULL << o); } } } long long ans = 0; for(int i=0;i<v;i++){ for(int j=i+1;j<v;j++){ long long k = 0; for(int b=0;b<w;b++){ unsigned long long x = msk[i][b] & msk[j][b]; k += __builtin_popcountll(x); } if(k >= 2) ans += k*(k-1)/2; } } cout << ans << "\n"; return 0; } C++ Shape Counts TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9
C++ Smallest Region Code TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9 #include <bits/stdc++.h> using namespace std; long long fn(const vector<array<int,4>>& rs, int lo, int hi, int ax) { int i1 = (ax == 0 ? 0 : 1), i2 = (ax == 0 ? 2 : 3); set<int> st{lo, hi}; for (auto &r : rs) { st.insert(r[i1]); st.insert(r[i2]); } vector<int> a(st.begin(), st.end()); vector<int> vf; for (int x : a) { bool ok = true; for (auto &r : rs) if (r[i1] < x && x < r[i2]) { ok = false; break; } if (ok) vf.push_back(x); } long long ans = (long long)1e18; for (size_t i = 0; i + 1 < vf.size(); ++i) { int d = vf[i+1] - vf[i]; if (d == 1) return 1; if (d < ans) ans = d; } for (size_t i = 0; i + 1 < a.size(); ++i) { int x = a[i], y = a[i+1]; if (y - x <= 1) continue; bool bad = false; for (auto &r : rs) if (r[i1] <= x && y <= r[i2]) { bad = true; break; } if (!bad) return 1; } return ans; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; if (!(cin >> n)) return 0; vector<array<int,4>> rs(n); for (int i = 0; i < n; ++i) cin >> rs[i][0] >> rs[i][1] >> rs[i][2] >> rs[i][3]; int ox1, oy1, ox2, oy2; cin >> ox1 >> oy1 >> ox2 >> oy2; long long w = fn(rs, ox1, ox2, 0); long long h = fn(rs, oy1, oy2, 1); cout << (w * h) << '\n'; return 0; } C++ Smallest Region Code TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9
C++ Rasikh Box Code TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int m, n; if (!(cin >> m >> n)) return 0; cin.ignore(numeric_limits<streamsize>::max(), '\n'); vector<int> c(n, 0); for (int i = 0; i < m; ++i) { string ln, s; getline(cin, ln); for (char ch : ln) if (ch != ' ') s.push_back(ch); for (int j = 0; j < n; ++j) if (s[j] == '*') ++c[j]; } int k; cin >> k; cin.ignore(numeric_limits<streamsize>::max(), '\n'); for (int t = 0; t < k; ++t) { string d; getline(cin, d); vector<int> f(m + 1, 0); for (int v : c) ++f[v]; vector<int> sfx(m + 2, 0); int cur = 0; for (int x = m; x >= 0; --x) { cur += f[x]; sfx[x] = cur; } int nm = n, nn = m; vector<int> nc(nn, 0); if (d == "right") { for (int col = 0; col < nn; ++col) nc[col] = sfx[col + 1]; } else { for (int col = 0; col < nn; ++col) nc[col] = sfx[m - col]; } m = nm; n = nn; c.swap(nc); } for (int i = 0; i < m; ++i) { for (int j = 0; j < n; ++j) { char ch = (i >= m - c[j]) ? '*' : '.'; if (j) cout << ' '; cout << ch; } if (i + 1 < m) cout << '\n'; } return 0; } C++ Rasikh Box Code TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9
C++ Gravity Code https://telegram.me/+_hn3cBQVbGliYTI9 #include <bits/stdc++.h> using namespace std; struct P { int x, y; bool operator==(const P &o) const { return x == o.x && y == o.y; } }; struct PH { size_t operator()(P const &p) const { return (uint64_t(uint32_t(p.x)) << 32) ^ uint32_t(p.y); } }; struct K { int x, y, s; bool operator==(const K &o) const { return x == o.x && y == o.y && s == o.s; } }; struct KH { size_t operator()(K const &k) const { uint64_t h = k.x; h = (h << 21) ^ k.y; h = (h << 21) ^ k.s; return size_t(h); } }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); vector<long long> a; long long v; while (cin >> v) a.push_back(v); int i = 0; int n = (int)a[i++]; vector<array<int,4>> sl(n); for (int j = 0; j < n; j++) { sl[j][0] = (int)a[i++]; sl[j][1] = (int)a[i++]; sl[j][2] = (int)a[i++]; sl[j][3] = (int)a[i++]; } int sx = (int)a[i++], sy = (int)a[i++], e = (int)a[i++]; unordered_map<P, vector<int>, PH> g; unordered_map<K, pair<int,int>, KH> nx; for (int s = 0; s < n; s++) { int x1 = sl[s][0], y1 = sl[s][1], x2 = sl[s][2], y2 = sl[s][3]; int dx = (x2 > x1) ? 1 : -1; int dy = (y2 > y1) ? 1 : -1; int L = abs(x2 - x1); if (dy == -1) { for (int k = 0; k < L; k++) { int x = x1 + dx * k; int y = y1 - k; g[{x,y}].push_back(s); nx[{x,y,s}] = {x + dx, y - 1}; } g[{x2,y2}].push_back(s); } else { for (int k = 0; k < L; k++) { int x = x2 - dx * k; int y = y2 - k; g[{x,y}].push_back(s); nx[{x,y,s}] = {x - dx, y - 1}; } g[{x1,y1}].push_back(s); } } auto fall = [&](int x, int y) -> pair<int,int> { for (int yy = y - 1; yy >= 0; yy--) { auto it = g.find({x, yy}); if (it != g.end()) return {x, yy}; } return {x, 0}; }; int x = sx, y = sy; if (g.find({x,y}) == g.end()) { auto p = fall(x, y); x = p.first; y = p.second; } while (true) { if (y == 0) break; auto it = g.find({x,y}); if (it == g.end()) { auto p = fall(x, y); x = p.first; y = p.second; continue; } auto &ids = it->second; if (ids.size() == 1) { int s = ids[0]; auto it2 = nx.find({x,y,s}); if (it2 == nx.end()) { auto p = fall(x, y); x = p.first; y = p.second; continue; } if (e == 0) break; e--; x = it2->second.first; y = it2->second.second; } else { long long c = 1LL * x * y; vector<pair<int,pair<int,int>>> dn; dn.reserve(ids.size()); for (int s : ids) { auto it3 = nx.find({x,y,s}); if (it3 != nx.end()) dn.push_back({s, it3->second}); } if ((long long)e <= c) { if (dn.empty()) { auto p = fall(x, y); x = p.first; y = p.second; continue; } break; } e -= (int)c; if (dn.empty()) { auto p = fall(x, y); x = p.first; y = p.second; continue; } int bx = 0, by = -1; for (auto &qq : dn) { int xx = qq.second.first; int yy = qq.second.second; if (yy > by) { by = yy; bx = xx; } } if (e == 0) break; e--; x = bx; y = by; } } cout << x << " " << y; return 0; } C++ Gravity Code TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9
C++ XOR on Array ✅ TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9 int minimize_difference(int N, vector<int>& A, int K, vector<int>& operand) { vector<vector<int>> possible_values(N); for (int idx = 0; idx < N; ++idx) { set<int> values; for (int mask = 0; mask < (1 << K); ++mask) { int new_value = A[idx]; for (int i = 0; i < K; ++i) { if (mask & (1 << i)) { new_value ^= operand[i]; } } https://telegram.me/PLACEMENTLELO values.insert(new_value); } possible_values[idx] = vector<int>(values.begin(), values.end()); sort(possible_values[idx].begin(), possible_values[idx].end()); } vector<pair<int, int>> all_values; for (int i = 0; i < N; ++i) { for (int value : possible_values[i]) { all_values.emplace_back(value, i); } } https://telegram.me/PLACEMENTLELO sort(all_values.begin(), all_values.end()); map<int, int> count; int left = 0; int min_range = INT_MAX; int distinct_count = 0; https://telegram.me/PLACEMENTLELO for (int right = 0; right < all_values.size(); ++right) { int value = all_values[right].first; int index = all_values[right].second; if (count[index] == 0) { ++distinct_count; } ++count[index]; https://telegram.me/PLACEMENTLELO while (distinct_count == N) { min_range = min(min_range, value - all_values[left].first); int left_value = all_values[left].first; int left_index = all_values[left].second; --count[left_index]; if (count[left_index] == 0) { --distinct_count; } ++left; } } return min_range; } C++ XOR on Array ✅ TCS CodeVita Zone 2 https://telegram.me/+_hn3cBQVbGliYTI9
Share your questions in this group 👇🏻 https://telegram.me/+oZ4x3k1RtXdkNWU1
TCS CodeVita Round 1 Zone 2 Details: Date and Time: 31 Oct 3pm to 1 Nov 3pm You can start the test anytime after 3pm. There will be 6 coding questions and a total time of 6 hours. 3 coding questions will be of medium difficulty, and the other 3 will be of hard difficulty. Zone 2 Distribution - Hyderabad, Delhi, Lucknow, Varanasi, Indore, Mumbai Join this group to discuss answers👇🏻 https://telegram.me/+oZ4x3k1RtXdkNWU1 All the Best !! Regards @PLACEMENTLELO
✅ TCS CodeVita Season 13 Complete Guide + Previous Year Questions with Solutions 🔥 Share this with your friends 😇
TCS CodeVita Answers will be uploaded here 👇🏻 https://telegram.me/+_hn3cBQVbGliYTI9 TCS CodeVita Discussion Group 👇🏻 https://telegram.me/+oZ4x3k1RtXdkNWU1 TCS CodeVita Answers Whatsapp Channel 👇🏻 https://whatsapp.com/channel/0029Vb67dZr4o7qMrkr3x70h
Latest Off-Campus Jobs and Internships are Uploaded regularly here👇 1. https://telegram.me/PLACEMENTLELO 2. https://telegram.me/OFF_CAMPUS_JOBS_AND_INTERNSHIPS ✅ Must Join ✅
Two Scouts Code C++ TCS CodeVita Round 1 Zone 1 https://telegram.me/+_hn3cBQVbGliYTI9 #include <bits/stdc++.h> using namespace std; int N, M; vector<vector<int>> g; int s1, s2, town; vector<int> res1, res2; https://telegram.me/PLACEMENTLELO void dfs1(int u, int target, int visited){ if(u == target){ res1.push_back(visited); return; } for(int v : g[u]){ if(visited & (1 << (v - 1))) continue; dfs1(v, target, visited | (1 << (v - 1))); } } https://telegram.me/PLACEMENTLELO void dfs2(int u, int target, int visited){ if(u == target){ res2.push_back(visited); return; } for(int v : g[u]){ if(visited & (1 << (v - 1))) continue; dfs2(v, target, visited | (1 << (v - 1))); } } https://telegram.me/PLACEMENTLELO int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); if(!(cin >> N >> M)) return 0; g.assign(N + 1, {}); for(int i = 0; i < M; ++i){ int a, b; cin >> a >> b; g[a].push_back(b); g[b].push_back(a); } cin >> s1 >> s2; cin >> town; res1.clear(); res2.clear(); dfs1(s1, town, 1 << (s1 - 1)); dfs2(s2, town, 1 << (s2 - 1)); int best = INT_MAX; int tbit = 1 << (town - 1); for(int m1 : res1){ if(!(m1 & tbit)) continue; for(int m2 : res2){ if(!(m2 & tbit)) continue; if((m1 & m2) == tbit){ int cnt = builtin_popcount(m1) + builtin_popcount(m2) - 1; if(cnt < best) best = cnt; } } } https://telegram.me/PLACEMENTLELO if(best == INT_MAX) cout << "Impossible\n"; else cout << best << "\n"; return 0; } Two Scouts Code C++ TCS CodeVita Round 1 Zone 1 https://telegram.me/+_hn3cBQVbGliYTI9
Share your questions in this group 👇🏻 https://telegram.me/+oZ4x3k1RtXdkNWU1
Whittle Game Code C++ 100% Correct ✅ TCS CodeVita Round 1 Zone 1 https://telegram.me/+_hn3cBQVbGliYTI9 #include <iostream> #include <sstream> #include <vector> #include <map> #include <algorithm> #include <cmath> using namespace std; map<pair<char, string>, int> expenses; map<pair<char, char>, int> loans; map<char, int> balances; void processTransaction(string transaction) { stringstream ss(transaction); string type; ss >> type; https://telegram.me/PLACEMENTLELO if (type == "L") { char borrower, lender; int amount; ss >> borrower >> lender >> type >> amount; loans[{borrower, lender}] += amount; } else { char paidBy; int amount; char temp; ss >> paidBy >> temp >> amount; https://telegram.me/PLACEMENTLELO balances[paidBy] -= amount; int sharedAmong = 0; while (ss >> temp) { char person; ss >> person; balances[person] += amount / 3; sharedAmong++; } balances[paidBy] += amount - (amount / 3 * sharedAmong); } } https://telegram.me/PLACEMENTLELO void calculateAndProcessInterest(int currentDay) { for (auto &loan : loans) { char borrower = loan.first.first; char lender = loan.first.second; int amount = loan.second; int weeks = (currentDay - 1) / 7; double interest = amount * pow(1.01, weeks) - amount; expenses[{lender, "I" + borrower}] += static_cast<int>(round(interest)); } } https://telegram.me/PLACEMENTLELO void reconcileBalances() { for (const auto &expense : expenses) { char borrower = expense.first.second[1]; char lender = expense.first.first; int amount = expense.second; if (amount <= loans[{borrower, lender}]) { loans[{borrower, lender}] -= amount; } else { amount -= loans[{borrower, lender}]; loans[{borrower, lender}] = 0; balances[borrower] += amount; balances[lender] -= amount; } } vector<pair<char, int>> creditors, debtors; for (const auto &balance : balances) { if (balance.second > 0) { creditors.push_back({balance.first, balance.second}); } else if (balance.second < 0) { debtors.push_back({balance.first, -balance.second}); } } https://telegram.me/PLACEMENTLELO sort(creditors.begin(), creditors.end()); sort(debtors.begin(), debtors.end()); auto creditor = creditors.begin(); auto debtor = debtors.begin(); while (creditor != creditors.end() && debtor != debtors.end()) { int settleAmount = min(creditor->second, debtor->second); cout << debtor->first << "/" << creditor->first << "/" << settleAmount << endl; creditor->second -= settleAmount; debtor->second -= settleAmount; if (creditor->second == 0) ++creditor; if (debtor->second == 0) ++debtor; } if (creditor == creditors.end() && debtor == debtors.end()) { cout << "NO DUES" << endl; } } https://telegram.me/PLACEMENTLELO int main() { int N; cin >> N; cin.ignore(); for (int i = 0; i < N; ++i) { string transaction; getline(cin, transaction); processTransaction(transaction); calculateAndProcessInterest(i + 1); } reconcileBalances(); return 0; } Whittle Game Code C++ 100% Correct ✅ TCS CodeVita Round 1 Zone 1 https://telegram.me/+_hn3cBQVbGliYTI9
Detective Chu Code C++ 100% Correct ✅ TCS CodeVita Round 1 Zone 1 https://telegram.me/+_hn3cBQVbGliYTI9 #include <bits/stdc++.h> using namespace std; https://telegram.me/PLACEMENTLELO int R, C; vector<string> g; bool ok(int r, int c) { return r >= 0 && r < R && c >= 0 && c < C && g[r][c] == '.'; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> R >> C; g.resize(R); for (int i = 0; i < R; i++) cin >> g[i]; https://telegram.me/PLACEMENTLELO string s; cin >> s; int dr[4] = {-1, 0, 1, 0}; int dc[4] = {0, 1, 0, -1}; unordered_set<int> endpos; for (int r0 = 0; r0 < R; ++r0) { for (int c0 = 0; c0 < C; ++c0) { if (g[r0][c0] != '.') continue; for (int d0 = 0; d0 < 4; ++d0) { int r = r0, c = c0, d = d0; bool bad = false; https://telegram.me/PLACEMENTLELO for (char ch : s) { if (ch == 'L') d = (d + 3) & 3; else if (ch == 'R') d = (d + 1) & 3; else { // 'S' r += dr[d]; c += dc[d]; if (!ok(r, c)) { bad = true; break; } } } if (!bad) endpos.insert(r * C + c); } } } https://telegram.me/PLACEMENTLELO if (endpos.empty()) cout << "Impossible"; else cout << endpos.size(); return 0; } Detective Chu Code C++ 100% Correct ✅ TCS CodeVita Round 1 Zone 1 https://telegram.me/+_hn3cBQVbGliYTI9