Tip 1: Practice problem-solving daily to strengthen algorithmic thinking.
Tip 2: Create as many projects as possible.
Tip 3: Participate in coding contests or on platforms to enhance speed and accuracy.
Tip 1: Highlight key achievements and experiences relevant to the role.
Tip 2: Ensure clarity, brevity, and accuracy in presenting information.
There were two sections: the first was the MCQ round, followed by the coding round which included 2 hard coding questions.
Given a string s, find the length of the longest palindromic substring in s.
Understanding the problem: Recognize that a palindromic substring reads the same backward as forward. The problem asks to find the longest palindromic substring in a given string.
Brute force approach: Start with each character in the string and expand outwards to check if the substring is a palindrome. Track the longest palindrome found.
Optimized approach: Utilize dynamic programming to optimize the solution. Create a boolean table dp[i][j] where dp[i][j] is true if the substring from index i to j is a palindrome.
Initialize base cases: Set dp[i][i] to true for all single characters, and dp[i][i+1] to true for all adjacent characters if they are the same.
Dynamic programming recurrence: Use the recurrence relation dp[i][j] = (s[i] == s[j] && dp[i+1][j-1]) to check if the substring from i to j is a palindrome based on the characters at indices i and j.
Update the maximum length: Keep track of the maximum length of palindromic substrings found during the process.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?