Max Area of Island | Leetcode 695

You are given an m x n binary matrix grid. An island is a group of 1‘s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by … Read More

Leetcode – 164. Maximum Gap

Given an integer array nums, return the maximum difference between two successive elements in their sorted form. If the array contains less than two elements, return 0. You must write an algorithm that … Read More

Print binary tree in zigzag order | 103. Binary Tree Zigzag Level Order Traversal Leetcode

Write a program to print ZigZag order traversal of a binary tree. For the below binary tree the zigzag order traversal will be 1 3 2 4 5 6 7. Given … Read More

14. Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “”. Example 1: Input: strs = … Read More

283. Move Zeroes

Given an integer array nums, move all 0‘s to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy … Read More

933. Number of Recent Calls

Problem statement: Number of Recent calls You have a RecentCounter class which counts the number of recent requests within a certain time frame. Implement the RecentCounter class: RecentCounter() Initializes the counter with zero recent requests. … Read More