All Posts

Leetcode 97: Interleaving String

Given three strings s1, s2, and s3, determine whether s3 can be formed by interleaving s1 and s2. An interleaving is a way of combining s1 and s2 such that the characters of s1 and s2 maintain their relative order in the final string.

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 131: Palindrome Partitioning

You are given a string s. Partition the string into all possible substrings such that each substring is a palindrome.

Leetcode 139: Word Break

Given a string s and a dictionary of words wordDict, return true if s can be segmented into a space-separated sequence of one or more words from the dictionary. The same word in the dictionary can be reused multiple times.

Leetcode 152: Maximum Product Subarray

You are given an integer array nums. Find the subarray that has the largest product, and return the product.