Question d’entretien chez Amazon

longest substring palindrome

Réponses aux questions d'entretien

Utilisateur anonyme

30 déc. 2017

Enjoy the life

Utilisateur anonyme

5 janv. 2018

public String longestPalindrome(String s) { int len = s.length(); if (len < 2) return s; for (int i = 0; i < len-1; i++) { extendPalindrome(s, i, i); //assume odd length, try to extend Palindrome as possible extendPalindrome(s, i, i+1); //assume even length. } return s.substring(lo, lo + maxLen); } private void extendPalindrome(String s, int j, int k) { while (j >= 0 && k < s.length() && s.charAt(j) == s.charAt(k)) { j--; k++; } if (maxLen < k - j - 1) { lo = j + 1; maxLen = k - j - 1; } }

Utilisateur anonyme

1 juin 2020

The key in generic questions like this, is to make sure to cover the fundamentals. There's usually a back-and-forth with the interviewer. Might be worth doing a mock interview with one of the Amazon Software Development Engineer I experts on Prepfully? Really helps to get some real-world practice and guidance. prepfully.com/practice-interviews