Palindrome Partitioning | palindrome partitioning | leetcode 131| dfs

preview_player
Показать описание




#Recursion #Palindrome #Backtraking #December #Leetcode #Hard #Algorithm #DataStructure #Java #Preparation #NG #nickode #CookCodeTravel #CCT
Рекомендации по теме
Комментарии
Автор

I am seeing your recursion and backtracking solutions from past few days, bro I must say your explanation is so clean and crisp

surajgrandhi
Автор

I did something like this. It ran slow, but it submitted (probably due to the small max size requirements of the string).
I did about 90% of a DP solution as well. The rows were the starting locations, the columns the ending locations, and the final being the UR corner. The state was the set of palindromes which worked for that range.
I ran through diagonally and set the state to a single match for the corresponding character.
Then I did the diagonal right above it, and so on until the end. Each cell was the combination of the sets to the left and below plus possibly a set for it's entire range.
The problem was the sets for the cell to it's LL was being represented twice. I couldn't figure out how to remove it properly, so then I started dinner.

crankyinmv
Автор

Can u please explain reason behind adding a copy of temp instead of temp??

surajgrandhi
Автор

Very good solution. I really like it. If we know how to slove combinations problem, then we can easily get the logic during interview. Thanks Naresh for your effort and support.

I would kindly request you to please make video on how to get dedication and motivation everyday to slove ds &algo problem in our office time.

praveenj
join shbcf.ru