Longest Increasing Path in a Matrix LeetCode Solution

Problem Statement Longest Increasing Path in a Matrix LeetCode Solution – Given an m x n integers matrix, return the length of the longest increasing path in matrix. From each cell, you can either move in four directions: left, right, up, or down. You may not move diagonally or move outside the boundary (i.e., wrap-around is not allowed). Input: …

Read more

Binary Tree Maximum Path Sum LeetCode Solution

Problem Statement Binary Tree Maximum Path Sum LeetCode Solution – A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once. Note that the path does not need …

Read more

Set Matrix Zeroes Leetcode Solution

Problem Statement The Set Matrix Zeroes LeetCode Solution – “Set Matrix Zeroes” states that you’re given an m x n integer matrix matrix.We need to modify the input matrix such that if any cell contains the element  0, then set its entire row and column to 0‘s. You must do it in …

Read more

Implement Stack and Queue using Deque

Problem Statement The problem “Implement Stack and Queue using Deque” states to write an algorithm to implement Stack and Queue using a Deque(Doubly Ended Queue). Example (Stack) Push(1) Push(2) Push(3) Pop() isEmpty() Pop() Size() 3 false 2 1 Example (Queue) Enqueue(1) Enqueue(2) Enqueue(3) Dequeue isEmpty() Size() Dequeue() 1 false 2 …

Read more

Translate »