Implemented Palindrome Partitioning using Backtracking algorithm (#1591)

* Implemented Palindrome Partitioning using Backtracking algorithm

* fix:Updated palindromePartition algorithm

* code clean up

* Rephrase doc comment & move to appropriate function

---------

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
This commit is contained in:
Nobert Patrick Ayesiga
2023-11-28 07:28:32 +03:00
committed by GitHub
parent 39d01138ec
commit 1b66d86bd7
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,12 @@
import partitionPalindrome from '../PalindromePartitioning'
describe('Palindrome Partitioning', () => {
it('should return all possible palindrome partitioning of s', () => {
expect(partitionPalindrome('aab')).toEqual([
['a', 'a', 'b'],
['aa', 'b']
])
expect(partitionPalindrome('a')).toEqual([['a']])
expect(partitionPalindrome('ab')).toEqual([['a', 'b']])
})
})