Palindromic Partitioning

Problem Statement Given an integer array,  partitioning the array is said to be a palindrome partitioning if every subarray of the partition is a palindrome. For example, 1 | 2 2 2 | 23 | 4 is a palindrome partitioning of array { 1,2,2,2,23,4 }. You have to find out the fewest cuts needed for palindrome partitioning of a…

Read more...

Reverse ArrayList Between 2 Given Indexes

Given an ArrayList and we need to reverse list from given startIndex to endIndex. example – List – [1,2,3,4], startIndex = 1, endIndex = 3 result = [1,4,3,2] List – [1,2,3,4,5], startIndex = 1, endIndex = 4 result = [1,5,4,3,2] Approach 1 – This approach starts swapping elements from startIndex and endIndex until startIndex is greater…

Read more...
Bitnami