Cognizant Help available....
DM @Mrtrueliving_ix For Help ..πΈ
https://t.me/code_alphix/5869?single
Test clearanceπ―
DM @Mrtrueliving_ix For Help ..
https://t.me/code_alphix/5869?single
π« Only for aptitude & technical helpπ«
Test clearance
Please open Telegram to view this post
VIEW IN TELEGRAM
All placement help available
- Cognizant
- syniti
- Autodesk
- IBM CIC - 6 pm
- IBM - All roles
- Amazon SDE
- infosys sp
- Goldman Sachs - 12th
.........more
On & off campus placement Help
Those who need π― test Clearance
DM @Mrtrueliving_ix for test clearance
- Cognizant
- syniti
- Autodesk
- IBM CIC - 6 pm
- IBM - All roles
- Amazon SDE
- infosys sp
- Goldman Sachs - 12th
.........more
On & off campus placement Help
Those who need π― test Clearance
DM @Mrtrueliving_ix for test clearance
Cognizant Slots booking are open....
DM @Mrtrueliving_ix
Test clearance guaranteeπ―
Please open Telegram to view this post
VIEW IN TELEGRAM
π1
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Cognizant Aptitude Help done β
4 pm || Slotπ»
DM for help @Mrtrueliving_ixπ―
#Cts #Aptitude #R2 #Offcampus
Test accomplished β€οΈ
4 pm || Slot
DM for help @Mrtrueliving_ix
#Cts #Aptitude #R2 #Offcampus
Test accomplished β€οΈ
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
import sys
sys.setrecursionlimit(1_000_000)
class DirNode:
def __init__(self, name):
self.name = name
self.children = {}
self.parent = None
class DirectoryTree:
def __init__(self):
self.root = DirNode("root")
self.total_nodes = 1
self.MAX_NODES = 10**6
self.path_map = {"root": self.root}
def get_node(self, path):
return self.path_map.get(path, None)
def build_path(self, parent_path, child_name):
return parent_path + "/" + child_name
def add_node(self, parent_path, *child_names):
parent = self.get_node(parent_path)
if not parent:
return
for name in child_names:
if name not in parent.children:
new_node = DirNode(name)
new_node.parent = parent
parent.children[name] = new_node
full_path = self.build_path(parent_path, name)
self.path_map[full_path] = new_node
self.total_nodes += 1
def count_descendants(self, path):
node = self.get_node(path)
if not node:
print("Invalid command")
return
def dfs(n):
count = 0
for cname, ch in n.children.items():
count += 1 + dfs(ch)
return count
print(dfs(node))
def cut_paste(self, src_path, dst_path):
src = self.get_node(src_path)
dst = self.get_node(dst_path)
if not src or not dst or src is self.root or src.name in dst.children:
print("Invalid command")
return
# Remove old paths
def remove_paths(n, current_path):
self.path_map.pop(current_path, None)
for cname, ch in n.children.items():
remove_paths(ch, self.build_path(current_path, cname))
remove_paths(src, src_path)
# Detach from old parent
del src.parent.children[src.name]
# Attach to new parent
src.parent = dst
dst.children[src.name] = src
# Add new paths
def add_paths(n, current_path):
self.path_map[current_path] = n
for cname, ch in n.children.items():
add_paths(ch, self.build_path(current_path, cname))
new_path = self.build_path(dst_path, src.name)
add_paths(src, new_path)
print("OK")
def copy_paste(self, src_path, dst_path):
src = self.get_node(src_path)
dst = self.get_node(dst_path)
if not src or not dst or src.name in dst.children:
print("Invalid command")
return
# Count number of nodes to be added
def count_nodes(n):
cnt = 1
for ch in n.children.values():
cnt += count_nodes(ch)
return cnt
needed = count_nodes(src)
if self.total_nodes + needed > self.MAX_NODES:
print("Invalid command")
return
# Clone subtree
def clone(n):
copy = DirNode(n.name)
for cname, ch in n.children.items():
child_copy = clone(ch)
child_copy.parent = copy
copy.children[cname] = child_copy
return copy
new_subtree = clone(src)
new_subtree.parent = dst
dst.children[new_subtree.name] = new_subtree
# Add new paths to map
def add_paths(n, current_path):
self.path_map[current_path] = n
for cname, ch in n.children.items():
add_paths(ch, self.build_path(current_path, cname))
new_path = self.build_path(dst_path, src.name)
add_paths(new_subtree, new_path)
self.total_nodes += needed
print("OK")
Part -1
π3
# Input handling
def main():
n, q = map(int, input().split())
tree = DirectoryTree()
for _ in range(n):
parts = input().split()
parent = parts[0]
children = parts[1:]
tree.add_node(parent, *children)
for _ in range(q):
parts = input().split()
cmd = parts[0]
if cmd == "countDescendants":
tree.count_descendants(parts[1])
elif cmd == "cutPaste":
tree.cut_paste(parts[1], parts[2])
elif cmd == "copyPaste":
tree.copy_paste(parts[1], parts[2])
if __name__ == "__main__":
main()
Part - 2
Namma yatri - 2
Please open Telegram to view this post
VIEW IN TELEGRAM
π1
Successfully cleared NetApp βοΈ
Test accomplished
Prev Help:
https://t.me/code_alphix/6137?single
DM for help
@Mrtrueliving_ix Β° @Mrtrueliving_ix
π― Success Rate & Test clearance π
Test accomplished
Prev Help:
https://t.me/code_alphix/6137?single
DM for help
@Mrtrueliving_ix Β° @Mrtrueliving_ix
π― Success Rate & Test clearance π
Please open Telegram to view this post
VIEW IN TELEGRAM
π1
All placement help available
- Cognizant
- Dtcc
- payU
- namma yatri
- wells forgo
- IBM - communication
- Deshaw
- innofied
- IBM - offline
- Flipkart
On // off campus placement
DM For help
@Mrtrueliving_ix
@Mrtrueliving_ix
Test clearance guaranteeπ―
High success rateπ
- Cognizant
- Dtcc
- payU
- namma yatri
- wells forgo
- IBM - communication
- Deshaw
- innofied
- IBM - offline
- Flipkart
On // off campus placement
DM For help
@Mrtrueliving_ix
@Mrtrueliving_ix
Test clearance guarantee
High success rate
Please open Telegram to view this post
VIEW IN TELEGRAM