All Posts

Leetcode 104: Maximum Depth of Binary Tree

You are given the root of a binary tree. Your task is to return the maximum depth of the tree. The maximum depth is defined as the number of nodes along the longest path from the root node down to the farthest leaf node.

Leetcode 110: Balanced Binary Tree

Given a binary tree, determine if it is height-balanced. A binary tree is considered height-balanced if for every node, the height of the left and right subtrees differs by no more than one.

Leetcode 111: Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth. The minimum depth is defined as the number of nodes along the shortest path from the root node down to the nearest leaf node. A leaf node is a node that does not have any children.

Leetcode 118: Pascal's Triangle

Given an integer numRows, return the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it. Your task is to generate and return the first ’numRows’ of the triangle.

Leetcode 121: Best Time to Buy and Sell Stock

You are given an array of prices where prices[i] represents the price of a stock on the i-th day. You want to maximize your profit by buying the stock on one day and selling it on a future day. Return the maximum profit you can achieve from this transaction. If no profit can be made, return 0.

Leetcode 125: Valid Palindrome

A string is considered a palindrome if, after converting all uppercase letters to lowercase and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include both letters and numbers. Given a string s, return true if it is a palindrome, otherwise return false.