2dbi
Home/MongoDB/Word Break
MMongoDB·DSAEngineerTechnical Phone Screen

Word Break

Problem

Return true if a string can be segmented into dictionary words.

Example

s="applepen", dict=[apple,pen] -> true

Constraints

  • 1 ≤ |s| ≤ 300

Approach

DP with memoization. Reported MongoDB question.

added 6 days ago
LeadersAccount