Check if a Binary Tree is Height-Balanced or Not
Problem Given a binary tree. You need to check if it is height-balanced or not. A tree is heigh…
Python SyntaxError: 'continue' not properly in loop Solution
While writing code in Python, we need to follow some rules, that define how the code must be writte…
Find Maximum Length Subarray Having an Equal Number of 0’s and 1’s
Problem Given a binary array nums, return the maximum length of a contiguous subarray with an eq…
How to Declare a List in Python?
There are various techniques in Python to initialize a list object. We can use Square brackets, lis…
Python Error "TypeError: 'type' object is not subscriptable" Solution
type is a reserved keyword in Python. If we print the type keyword, we get an object by name &…
Subarray with Sum k
Problem Given an unsorted array arr of size N, find a contiguous subarray that adds to a given n…
Replace Every Array Element With The Product of Every Other Element
Problem Given an integer array nums, return an array res such that res[i] is equal to the …
Sort an array 0s, 1s and 2s (Dutch National Flag Problem)
Problem Given an array containing only 0s, 1s and 2s. Write an efficient algorithm to sort the a…
Longest? ?Bitonic? ?Subarray? ?Problem? ?
Problem An array arr is a bitonic array if and only if: arr.length >= 3 AND There exists…
Find Maximum Subarray Sum
Problem The objective is to find the elements of a continuous subarray nums of integers that hav…
Maximum Sum Circular Subarray
Problem Given a circular integer array nums of length n, return the maximum possible sum of a no…
Maximum Difference Between Two Elements Such that Larger Element Appears After the Smaller Number
Problem Find the maximum difference between two array elements such that the bigger element appe…