Given an array of words and a length L, format the text such that each line has exactly L characters and is fu…
Leetcode 87. Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursi…
Leetcode 115.Distinct Subsequences
Given a string S and a string T, count the number of distinct subsequences of S which equals T. A subsequence …
Leetcode 150. Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, , /. Each…
Leetcode 158. Read N Characters Given Read4 II - Call multiple times
The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number …
Leetcode 72. Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each op…
Leetcode 210. Course Schedule II
There are a total of n courses you have to take, labeled from 0 to n – 1. Some courses may have prerequi…
Leetcode 227. Basic Calculator II
Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-n…
Leetcode 157. Read N Characters Given Read4
The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number …
Leetcode 156. Binary Tree Upside Down
Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares th…
Leetcode 301. Remove Invalid Parentheses
Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible …
Leetcode 172. Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic t…