2019-11-10 LeetCode in Rust LeetCode 139. Word Break Problem Statement use std::collections::HashSet;impl Solution { pub fn word_break(s: String, word_dict: Vec<String>) -> bool { let set: HashSet<String> = word_dict.into_iter().collect(); let mut dp = vec![false; s.len() + 1]; dp[0] = true; for i in 1..s.len() + 1 { if dp[i] { continue; } for j in 0..i { if !dp[j] { continue; } let slice = &s[j..i]; if set.contains(slice) { dp[i] = true; break; } } } return dp[s.len()]; }} Newer LeetCode 1249. Minimum Remove to Make Valid Parentheses Older LeetCode 140. Word Break II