Write a function to find the longest palindromic substring in a given string.
MediumProblem Statement
Write a function to find the longest palindromic substring in a given string.
Sample Input
A string: "babad"
Sample Output
Longest palindromic substring: "bab"
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
fun isSymmetric(matrix: Array<Array<Int>>): Boolean {
// Add your code here to check if the matrix is symmetric
}
fun main() {
val matrix = arrayOf(
arrayOf(1, 2, 3),
arrayOf(2, 4, 5),
arrayOf(3, 5, 6)
)
if (isSymmetric(matrix)) {
println("The matrix is symmetric")
} else {
println("The matrix is not symmetric")
}
}
Input
A string: "babad"
Expected Output
Longest palindromic substring: "bab"