x 139. Word Break

ideation

Check how many ways to climb stairs

dp + substring

time: O(m x n^2), n is the length of string, m is the length of wordDict

space: O(n)

Brute Force: TLE

Last updated