Amazon Coding Interview - Longest Palindrome Substring (JavaScript)

preview_player
Показать описание
One of Amazon's most commonly asked coding interview questions according to LeetCode.

Video contains explanation and solution of Amazon Longest Palindrome Substring coding interview problem in JavaScript.

This coding interview question is commonly asked by companies like: Google, Facebook, Snapchat, Amazon, Uber, LinkedIn, Microsoft, Apple and many others.

Problem is:
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.

Example 1:
Input: "babad"
Output: "bab"
Note: "aba" is also a valid answer.

Example 2:
Input: "cbbd"
Output: "bb"

If you have any question feel free to ask me in the comments section.

Follow me on:
Рекомендации по теме
Комментарии
Автор

Great video! Small fix for the brute force solution, you need to add 1 to the second index passed to substring() on line 64: `let subStr = s.substring(i, j + 1);`

lucasburruel
Автор

thanks very much! watch 5-6 videos about this problem, yours is the best one

boburkhon_sh
Автор

great video! put out more data structures problems in js.

junaiderade
Автор

Hi I have a question, in the optimize version inside the getCenter function how does 'R' value change?, for example in the first iteration from 0 to 3, thanks!

elisamartinez
Автор

pass "bb" and "b" your broutforse will not work sir

rupeshpatil
welcome to shbcf.ru