coderz.py

Keep Coding Keep Cheering!

Find the Smallest Missing Positive Integer

Problem Statement (Asked By Stripe) You are given an array of integers. Your task is to find the smallest missing positive integer in O(N) time using O(1) additional space. In other words, identify the smallest positive number that is not present in the array. The array may include: You are allowed to modify the input […]

January 2, 2025 | dsa, DSA Sheet, Stripe | No comments

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

Generate Parenthesis | Intuition + Code | Recursion Tree | Backtracking | Java

Problem Statement: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Input: n = 3 Output: [“((()))”,”(()())”,”(())()”,”()(())”,”()()()”]Example 2: Input: n = 1 Output: [“()”] Solution: This problem can be solved using the concept of backtracking, Let’s see how to approach it. We have to write a function generate([], left, right, […]

September 24, 2024 | 23 DSA Patterns | No comments

Square Root of Integer

Given an integer A. Compute and return the square root of A. If A is not a perfect square, return floor(sqrt(A)). The value of A can cross the range of Integer.

August 10, 2023 | DSA Sheet | No comments

Build Array From Permutation

Given a zero-based permutation nums (0-indexed), build an array ans of the same length where ans[i] = nums[nums[i]] for each 0 <= i < nums.length and return it. A zero-based permutation nums is an array of distinct integers from 0 to nums.length - 1 (inclusive).

August 9, 2023 | DSA Sheet | No comments

DSA: Heap

A heap is a specialized tree-based data structure that satisfies the heap property. It is commonly used to implement priority queues and efficient sorting algorithms like heap sort.

June 10, 2023 | Algorithm, Data Structure | No comments

Mule 4: Multipart/form-data in HTTP Request Connector

Multipart/Form-Data service using the HTTP Request connector in Mule 4

May 24, 2023 | Mule 4 | No comments

Mule 4: HTTP request connector

the HTTP Request connector is a powerful component that allows you to send HTTP requests and receive responses from external systems or APIs

May 23, 2023 | Mule 4 | No comments

Advertisement