coderz.py

Keep Coding Keep Cheering!

Serialize and Deserialize a Binary Tree

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

Product of Array Except Self

Problem Statement (Asked By Uber) Given a list of integers, return a new list such that each element at index i of the new list is the product of all the elements in the original list except the one at i. For instance, if the input is [1, 2, 3, 4, 5], the expected output […]

December 30, 2024 | Algorithm, array, Data Structure, dsa, Uber | No comments

Two Sum: Check for Two Numbers with Sum K

Problem Statement (Asked By Google) Given a list of integers and a target number k, determine if there exist two numbers in the list whose sum equals k. For example, given [10, 15, 3, 7] and k = 17, return True because 10 + 7 = 17. Bonus: Can you solve this in a single […]

December 29, 2024 | array, dsa | No comments

Advertisement