Tip 1: Make sure to solve at least one standard interview preparation sheet to familiarise yourself with common interview questions and problem-solving techniques.
Tip 2: Prioritise preparing fundamental Computer Science topics such as Object-Oriented Programming (OOPS), Operating Systems (OS), and Database Management Systems (DBMS) to strengthen your knowledge base for technical interviews.
Tip 1: Ensure that your resume includes at least 2 substantial and impressive projects that showcase your skills and experiences effectively.
Tip 2: Include all your coding profiles, regardless of the number of questions you have attempted on each platform. Highlighting your coding profiles can give interviewers insight into your problem-solving abilities and coding expertise.



Gcd of two numbers (X, Y) is defined as the largest integer that divides both ‘X’ and ‘Y’.
#include
using namespace std;
int GCD[1002][1002];
bool vis[1002][1002][2];
int dp[1002][1002][2];
void pre()
{
for ( int i = 1; i <= 1000; i++ ) {
for ( int j = 1; j <= i; j++ ) {
GCD[i][j] = GCD[j][i] = __gcd(i,j);
}
}
return;
}
int f(int a, int b, int turn)
{
if ( turn == 0 ) {
if ( a == 1 ) return 0;
}
if ( turn == 1 ) {
if ( b == 1 ) return 0;
}
if ( vis[a][b][turn] ) return dp[a][b][turn];
vis[a][b][turn] = true;
int ans = 0;
if ( turn == 0 ) {
ans |= (!f(a,b-1,turn^1));
if ( GCD[a][b] != 1 ) ans |= (!f(a,b/GCD[a][b],turn^1));
}
else {
ans |= (!f(a-1,b,turn^1));
if ( GCD[a][b] != 1 ) ans |= (!f(a/GCD[a][b],b,turn^1));
}
dp[a][b][turn] = ans;
return ans;
}
int main() {
int t,A,B;
pre();
cin >> t;
while ( t-- ) {
cin >> A >> B;
if(A==1 && B==1)
cout<<"Draw"< else if(A==1)
cout<<"Prateek"< else if(B==1)
cout<<"Gautam"< else{
if ( f(A,B,0) ) cout << "Gautam"< else cout << "Prateek"< }
}
return 0;
}



1. Delete a character
2. Replace a character with another one
3. Insert a character
Strings don't contain spaces in between.
That sounds like a great approach! Using dynamic programming and constructing a 2D matrix t[][] to represent the minimum number of operations needed to transform substrings word1[0...i-1] into word2[0...j-1] is a common technique for solving string transformation problems.
By calculating and storing the minimum operations in the matrix t, you can efficiently determine the optimal solution for transforming one string into another. This dynamic programming technique can be quite useful in various string manipulation and transformation scenarios.
If you have any specific questions or need further assistance with your dynamic programming implementation, feel free to ask!



1. There are no 2 adjacent elements having same value (as mentioned in the constraints).
2. Do not print anything, just return the index of the peak element (0 - indexed).
3. 'True'/'False' will be printed depending on whether your answer is correct or not.
Input: 'arr' = [1, 8, 1, 5, 3]
Output: 3
Explanation: There are two possible answers. Both 8 and 5 are peak elements, so the correct answers are their positions, 1 and 3.
First I told the linear search solution then the binary search one, and then the interviewer asked me to prove that I will always get a solution for the binary search approach. I proved this via the contradiction method.



I used tabular dp



Let ‘N’ = 4, ‘Arr’ be [1, 2, 5, 4] and ‘K’ = 3.
then the elements of this array in ascending order is [1, 2, 4, 5]. Clearly, the 3rd smallest and largest element of this array is 4 and 2 respectively.
First I told using sorting. Then I used the Min Heap approach. The interviewer was pretty happy about this.



str = "ababc"
The longest palindromic substring of "ababc" is "aba", since "aba" is a palindrome and it is the longest substring of length 3 which is a palindrome.
There is another palindromic substring of length 3 is "bab". Since starting index of "aba" is less than "bab", so "aba" is the answer.
Optimizing a brute force approach by implementing a dynamic programming (DP) solution is a commendable strategy. Dynamic programming is an effective technique for optimizing recursive or brute force algorithms by storing intermediate results in a table or array, which helps avoid redundant computations and significantly improves the overall efficiency of the solution.
By transitioning to a DP approach, you likely achieved a more efficient and faster solution to the problem, which is highly valued in technical interviews. Employing DP demonstrates your problem-solving skills and ability to optimize algorithms, which are essential qualities sought in candidates.
Well done on optimizing your approach and providing a DP solution! If you have any further questions or need assistance with other problems, feel free to ask. Good luck with your interview preparation!

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?