Find Intersection of Two Singly Linked Lists
You are given two singly linked lists that intersect at some node. Your task is to find and return the first intersecting node.
March 11, 2025 | Data Structure, Google | No comments
Keep Coding Keep Cheering!
You are given two singly linked lists that intersect at some node. Your task is to find and return the first intersecting node.
March 11, 2025 | Data Structure, Google | No comments
Find the length of the longest absolute path to a file within the abstracted file system. The length is measured in characters.
The formula for the area of a circle is given by πr². Use the Monte Carlo method to approximate the value of π to three decimal places.
A unival tree (short for “universal value tree”) is a tree in which all nodes have the same value.
Given the root of a binary tree, determine how many unival subtrees it contains.
For example, the following tree has 5 unival subtrees:
January 6, 2025 | Binary Tree, dsa, DSA Sheet, Google | No comments
An XOR-linked list is a memory-efficient version of a doubly linked list. Instead of each node storing separate next and prev pointers, each node contains a single field called both, which stores the result of the XOR operation on the memory addresses of the next and previous nodes.
Given the root of a binary tree, create two functions:
serialize(root) – Converts the binary tree into a string representation.
deserialize(s) – Reconstructs the binary tree from its string representation.
January 1, 2025 | array, dsa, DSA Sheet, Google | No comments