COGNIZANT EXAM HELP GROUP
3.55K subscribers
5.3K photos
21 videos
10 files
3.22K links
๐Ÿš€ Placement Preparation Hub

๐ŸŽ“ From Preparation to Placement

โšก OA Support โ€ข Coding โ€ข Aptitude โ€ข Technical โ€ข HR

๐ŸŒŸ Trusted by Hundreds of Students

๐Ÿ† 372+ Placement Successes โœ…

๐Ÿ“ฉ DM: @Mrtrueliving_ix

๐Ÿ’™ Turning Aspirations into Offer Letters.
Download Telegram
Ukg || customer experience intern โœ“


DM for any placement Help

@Mrtrueliving_ix @Mrtrueliving_ix

#Ukg #ONCAMPUS #R1
TCS codevita โœ“
Successfully cleared Accenture ONCAMPUS โœ“>


Now they are eligible for communication โœ“

DM for any placement Help available

On // Offcampus โœ“

Computer Lab or own laptop โœ“


@Mrtrueliving_ix @Mrtrueliving_ix

S1:https://t.me/Code_alphix/8587?single

S2:https://t.me/Code_alphix/8585?single
IBM CIC Help Available

@Mrtrueliving_ix @Mrtrueliving_ix

๐Ÿ’ฏ Test Clearance โค๏ธ

https://t.me/Code_alphix/8555?single
TCS codevita โœ“
TCS codevita โœ“
IBM both codes are available

@Mrtrueliving_ix โœ“
TCS Coding Questions Available Now! ๐Ÿš€

๐Ÿ”ฅ Problems Covered:
โœ… Rishikbox
โœ… Shapecount
โœ… Smallest Region

๐Ÿ’ฏ Plag-Free Solutions โ€” Tested & Verified!

๐Ÿ“ข Check our page โ€” weโ€™ll be posting the full codes soon!
๐Ÿ‘‰ https://t.me/Code_alphix


Add your friends

Helpthemtosucceed โค๏ธ
import java.util.*;

public class RasikhBox {
    static void gravity(char[][] g) {
        int r = g.length, c = g[0].length;
        for (int col = 0; col < c; col++) {
            int cnt = 0;
            for (int row = 0; row < r; row++)
                if (g[row][col] == '*') cnt++;
            for (int row = 0; row < r - cnt; row++) g[row][col] = '.';
            for (int row = r - cnt; row < r; row++) g[row][col] = '*';
        }
    }

    static char[][] rightR(char[][] g) {
        int r = g.length, c = g[0].length;
        char[][] res = new char[c][r];
        for (int i = 0; i < c; i++)
            for (int j = 0; j < r; j++)
                res[i][j] = g[r - 1 - j][i];
        return res;
    }

    static char[][] leftR(char[][] g) {
        int r = g.length, c = g[0].length;
        char[][] res = new char[c][r];
        for (int i = 0; i < c; i++)
            for (int j = 0; j < r; j++)
                res[i][j] = g[j][c - 1 - i];
        return res;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt(), n = sc.nextInt();
        char[][] box = new char[m][n];
        for (int i = 0; i < m; i++)
            for (int j = 0; j < n; j++)
                box[i][j] = sc.next().charAt(0);
        int k = sc.nextInt();
        String[] ops = new String[k];
        for (int i = 0; i < k; i++) ops[i] = sc.next();
        gravity(box);
        for (String op : ops) {
            if (op.equals("right")) box = rightR(box);
            else box = leftR(box);
            gravity(box);
        }
        int R = box.length, C = box[0].length;
        for (int i = 0; i < R; i++) {
            for (int j = 0; j < C; j++) {
                System.out.print(box[i][j]);
                if (j + 1 < C) System.out.print(" ");
            }
            if (i + 1 < R) System.out.println();
        }
        sc.close();
    }
}

Rishikbox โœ“ TCS codevita โœ“

@Mrtrueliving_ix @Mrtrueliving_ix
๐Ÿ’ฏ Plagfree โœ“

Stay tuned for more more codes

https://t.me/Code_alphix

Review โ„ข : https://t.me/Code_alphix/8595
โค2
AbcChallange โœ“ // codevita โœ“
โค1
import bisect

def lis_length(v):
d = []
for x in v:
pos = bisect.bisect_left(d, x)
if pos == len(d):
d.append(x)
else:
d[pos] = x
return len(d)

def main():
n = int(input().strip())
s = input().strip().split()
s = [c[0] for c in s]
fixed_parts = list(map(int, input().strip().split()))
fixed_pos = [p - 1 for p in fixed_parts]

orders = [
['A', 'B', 'C'], ['A', 'C', 'B'],
['B', 'A', 'C'], ['B', 'C', 'A'],
['C', 'A', 'B'], ['C', 'B', 'A']
]

cntA, cntB, cntC = s.count('A'), s.count('B'), s.count('C')
best = float('inf')
found = False

for ord_ in orders:
size0 = cntA if ord_[0] == 'A' else cntB if ord_[0] == 'B' else cntC
size1 = cntA if ord_[1] == 'A' else cntB if ord_[1] == 'B' else cntC
s0, s1, s2 = 0, size0, size0 + size1

T = [None] * n
for i in range(s0, s1): T[i] = ord_[0]
for i in range(s1, s2): T[i] = ord_[1]
for i in range(s2, n): T[i] = ord_[2]

ok = True
for p in fixed_pos:
if p < 0 or p >= n or s[p] != T[p]:
ok = False
break
if not ok:
continue

slots = {'A': [], 'B': [], 'C': []}
for i, c in enumerate(T):
slots[c].append(i)

ia = ib = ic = 0
mapped = []

for c in s:
if c == 'A':
if ia >= len(slots['A']): ok = False; break
mapped.append(slots['A'][ia]); ia += 1
elif c == 'B':
if ib >= len(slots['B']): ok = False; break
mapped.append(slots['B'][ib]); ib += 1
elif c == 'C':
if ic >= len(slots['C']): ok = False; break
mapped.append(slots['C'][ic]); ic += 1
if not ok:
continue

keep = lis_length(mapped)
shifts = n - keep
best = min(best, shifts)
found = True

if not found:
print("Impossible", end="")
else:
print(best, end="")

main()

AbcChallange โœ“ || codevita โœ“

@Mrtrueliving_ix @Mrtrueliving_ix

ยฎ: https://t.me/Code_alphix/8604
โค2
import sys
from itertools import combinations
https://t.me/Code_alphix
input = sys.stdin.readline

n = int(input().strip())
a = []https://t.me/Code_alphix
for _ in range(n):
x1, y1, x2, y2 = map(int, input().split())
if x2 < x1: x1, x2 = x2, x1
if y2 < y1: y1, y2 = y2, y1
a.append((x1, y1, x2, y2))

ox1, oy1, ox2, oy2 = map(int, input().split())https://t.me/Code_alphix
if ox2 < ox1: ox1, ox2 = ox2, ox1
if oy2 < oy1: oy1, oy2 = oy2, oy1
https://t.me/Code_alphix
xs, ys = [], []
for x in range(ox1 + 1, ox2):
if all(not (r[0] < x < r[2]) for r in a):
xs.append(x)
https://t.me/Code_alphix
for y in range(oy1 + 1, oy2):
if all(not (r[1] < y < r[3]) for r in a):
ys.append(y)

mA = float('inf')https://t.me/Code_alphix
vx_all = [ox1] + xs + [ox2]
vy_all = [oy1] + ys + [oy2]

for mx in range(1 << len(xs)):
@code_alphix
vx = [ox1] + [xs[i] for i in range(len(xs)) if (mx >> i) & 1] + [ox2]
vx.sort()@code_alphix
for my in range(1 << len(ys)):
vy = [oy1] + [ys[j] for j in range(len(ys)) if (my >> j) & 1] + [oy2]
vy.sort()
for i in range(len(vx) - 1):
for j in range(len(vy) - 1):
ar = (vx[i + 1] - vx[i]) * (vy[j + 1] - vy[j])
if ar < mA:
mA = ar
https://t.me/Code_alphix
if mA == float('inf'):
mA = (ox2 - ox1) * (oy2 - oy1)
print(mA)

Smallest region โœ“ || codevita โœ“

@Mrtrueliving_ix @Mrtrueliving_ix


Proof: https://t.me/Code_alphix/8594
โค1๐Ÿ‘€1
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

static vector<P> mrg(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 r.back().second = max(r.back().second, p.second);
}
return r;
}

int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);

int n;
cin >> n;
map<ll, vector<P>> h, v;

for (int z = 0; z < 1; z++) {}

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);
h[y1].push_back({x1, x2});
} else {
if (y1 > y2) swap(y1, y2);
v[x1].push_back({y1, y2});
}
}

struct H { ll y, l, r; };
vector<H> hs;
for (auto &e : h) {
ll y = e.first;
auto seg = mrg(e.second);
for (auto &q : seg) hs.push_back({y, q.first, q.second});
}

struct V { ll x, a, b; };
vector<V> vs;
for (auto &e : v) {
ll x = e.first;
auto seg = mrg(e.second);
for (auto &q : seg) vs.push_back({x, q.first, q.second});
}

int Hs = hs.size(), Vs = vs.size(), w = (Hs + 63) >> 6;
vector<vector<unsigned long long>> m(Vs, vector<unsigned long long>(w, 0ULL));

for (int d = 0; d < 2; d++) { if (d == -1) break; }

for (int i = 0; i < Vs; i++) {
ll x = vs[i].x, a = vs[i].a, b = vs[i].b;
for (int j = 0; j < Hs; j++) {
const auto &hh = hs[j];
if (a <= hh.y && hh.y <= b && hh.l <= x && x <= hh.r) {
int bb = j >> 6, off = j & 63;
m[i][bb] |= (1ULL << off);
}
}
}

ll ans = 0;
for (int i = 0; i < Vs; i++) {
for (int j = i + 1; j < Vs; j++) {
ll cnt = 0;
for (int b = 0; b < w; b++) {
unsigned long long x = m[i][b] & m[j][b];
cnt += __builtin_popcountll(x);
}
if (cnt >= 2) ans += cnt * (cnt - 1) / 2;
}
}

for (int d = 0; d < 1; d++) {}

cout << ans;
return 0;
}

Shapecount โœ“ || TCS codevita โœ“



@Mrtrueliving_ix @Mrtrueliving_ix
โค4
TCS codevita Help done โœ…

DM for any placement Help โœ“

@Mrtrueliving_ix @Mrtrueliving_ix

4/ 6 Qs solved ๐Ÿค— || ๐Ÿ’ฏ plagfree coding

Only accepted codes ๐Ÿ˜Žโค๏ธ๐ŸคŸ

No presentation errors โŒโŒโŒ

#TCS #codevita #Offcampus
F1โœ“
import java.io.*;
import java.util.*;

public class F1Logistics {

static class Race {
int x, y, d;
Race(int x, int y, int d) {
this.x = x;
this.y = y;
this.d = d;
}
}

static List<Integer>[] adj;
static int[] match;
static boolean[] vis;

public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
String s = br.readLine();
if (s == null || s.trim().isEmpty()) {
pw.print(0);
pw.flush();
return;
}
int n = Integer.parseInt(s.trim());
Race[] a = new Race[n];
for (int i = 0; i < n; i++) {
StringTokenizer st = new StringTokenizer(br.readLine());
a[i] = new Race(Integer.parseInt(st.nextToken()),
Integer.parseInt(st.nextToken()),
Integer.parseInt(st.nextToken()));
}

adj = new ArrayList[n];
for (int i = 0; i < n; i++) adj[i] = new ArrayList<>();

for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i == j) continue;
Race r1 = a[i], r2 = a[j];
if (r2.d > r1.d) {
long dist = Math.abs(r1.x - r2.x) + Math.abs(r1.y - r2.y);
if (r2.d - r1.d >= dist) adj[i].add(j);
}
}
}

match = new int[n];
Arrays.fill(match, -1);
int cnt = 0;
for (int i = 0; i < n; i++) {
vis = new boolean[n];
if (dfs(i)) cnt++;
}

pw.print(n - cnt);
pw.flush();
}

static boolean dfs(int u) {
for (int v : adj[u]) {
if (!vis[v]) {
vis[v] = true;
if (match[v] == -1 || dfs(match[v])) {
match[v] = u;
return true;
}
}
}
return false;
}
}

F1 โœ“ @Mrtrueliving_ix || codevita โœ“

https://t.me/Code_alphix/8613
โค1
from collections import defaultdict, deque
import sys

def f(n, nm, sk, fr, rv, cap):
idx = {x: i for i, x in enumerate(nm)}
p = list(range(n))
def fd(x):
while x != p[x]:
p[x] = p[p[x]]
x = p[x]
return x
def un(a, b):
ra, rb = fd(a), fd(b)
if ra != rb:
p[rb] = ra
for a, b in fr:
un(idx[a], idx[b])
gmap = defaultdict(list)
for i in range(n):
gmap[fd(i)].append(i)
gs = []
for v in gmap.values():
tot = sum(sk[i] for i in v)
gs.append((v, tot))
m = len(gs)
gid = {}
for i, (v, _) in enumerate(gs):
for x in v:
gid[x] = i
rg = defaultdict(set)
for a, b in rv:
ga, gb = gid[idx[a]], gid[idx[b]]
if ga != gb:
rg[ga].add(gb)
rg[gb].add(ga)
vis = [0]*m
comps = []
for i in range(m):
if not vis[i]:
q = deque([i])
vis[i] = 1
comp = []
while q:
u = q.popleft()
comp.append(u)
for v in rg[u]:
if not vis[v]:
vis[v] = 1
q.append(v)
comps.append(comp)
chs = []
for c in comps:
opt = []
k = len(c)
for mask in range(1<<k):
ts = tc = 0
ok = 1
for i in range(k):
if (mask>>i)&1:
for j in range(i+1,k):
if (mask>>j)&1 and c[j] in rg[c[i]]:
ok = 0
break
if not ok:
break
ts += gs[c[i]][1]
tc += len(gs[c[i]][0])
if ok and ts <= cap:
opt.append((ts, tc))
opt.sort()
flt = []
bp = 0
for s, p in opt:
if p > bp:
flt.append((s, p))
bp = p
chs.append(flt)
dp = [0]*(cap+1)
for opt in chs:
ndp = dp[:]
for s, p in opt:
for w in range(cap-s, -1, -1):
if dp[w]+p > ndp[w+s]:
ndp[w+s] = dp[w]+p
dp = ndp
return max(dp)

def main():
n = int(input().strip())
nm = input().strip().split()
sk = list(map(int, input().strip().split()))
nf = int(input().strip())
fr = [tuple(input().strip().split()) for _ in range(nf)]
nr = int(input().strip())
rv = [tuple(input().strip().split()) for _ in range(nr)]
cap = int(input().strip())
sys.stdout.write(str(f(n, nm, sk, fr, rv, cap)))

if __name__ == "__main__":
main()

Uno โœ“ || @Mrtrueliving_ix - codevita โœ“
๐Ÿš€
TCS CodeVita Verified Codes ๐Ÿ”ฅ


๐Ÿ“Œ Many are posting codes โ€” but thereโ€™s no guarantee they pass all test cases.


โš ๏ธ Some face presentation or runtime errors.

โœ… Only this page provides 100% accepted & verified codes! ๐Ÿ’ฏ

๐Ÿง  Avoid plagiarism โ€” TCS checks for code similarity.
๐Ÿ’ก Add a dummy loop or change structure to make it unique.

๐Ÿ“ฒ Join here:
https://t.me/Code_alphix
โณ Donโ€™t wait โ€” share with your friends before itโ€™s deleted!
Spread to maximum people ๐Ÿš€

#TCSCodeVita #CodeAlphix #PlacementPrep
โค1