Hi everyone !!
I was recently asked this question in the onsite at Amazon.
https://leetcode.com/problems/word-break/
I explained him the standard solution using BFS which is O(n) time ans O(n) space.However, the interviewer was deeply interested with me solving the question via making a Graph and then solving it.
I didn't find it to be any better approach as it had the same time and space run.
Can anyone help me with the approaches to this question ?
What is the most optimum solution to this problem ?