BYJUS interview experience Real time questions & tips from candidates to crack your interview

SDE - Intern

BYJUS
upvote
share-icon
3 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Journey
I started dsa practicing from the April 2022 and follow youtube playlist for the other topics like operating system ,OOPS and DBMS from and follow standard sheet of striver and love baber for dsa part.
Application story
I filled the internship Form of byjus which is provided by my college in the mid of August and then OA was on 29 August
Why selected/rejected for the role?
Due to my weak english communication and i was not able to explain the heap sort properly to my second interviewer
Preparation
Duration: 3 months
Topics: Data Structure, OOPs, DBMS, OS,Project , React js
Tip
Tip

Tip 1 : Practice Atleast 250 Questions from a standard dsa sheet
Tip 2 : Have good project in resume

Application process
Where: Campus
Eligibility: 7.5
Resume Tip
Resume tip

Tip 1:Mention all technical skills
Tip 2:have good project

Interview rounds

01
Round
Easy
Online Coding Interview
Duration60 mins
Interview date29 Aug 2022
Coding problem2

1. Edit Distance

Moderate
30m average time
70% success
0/80
Asked in companies
WalmartOYOGoldman Sachs

You are given two strings 'S' and 'T' of lengths 'N' and 'M' respectively. Find the "Edit Distance" between the strings.

Edit Distance of two strings is the minimum number of steps required to make one string equal to the other. In order to do so, you can perform the following three operations:

1. Delete a character
2. Replace a character with another one
3. Insert a character
Note:
Strings don't contain spaces in between.
Problem approach

Approach
Here's the step-by-step approach:

Initialize a matrix dp of size (m+1) x (n+1), where m and n are the lengths of word1 and word2, respectively.
Fill in the base cases:
dp[i][0] = i for i from 0 to m.
dp[0][j] = j for j from 0 to n.
For each i from 1 to m and each j from 1 to n, compute the value of dp[i][j] as follows:
If word1[i-1] is equal to word2[j-1], then dp[i][j] = dp[i-1][j-1]. Otherwise, dp[i][j] is the minimum of the following three values plus 1:
a) dp[i][j-1], which represents inserting a character in word1.
b) dp[i-1][j], which represents deleting a character in word1.
c) dp[i-1][j-1], which represents replacing a character in word1.
Return dp[m][n], which is the minimum number of operations required to convert word1 to word2.
Complexity
Time complexity:
The time complexity of the solution is O(mn), where m and n are the lengths of the input strings. This is because we need to fill in an (m+1) x (n+1) matrix, and each cell takes constant time to fill.

Space complexity: O(mn)

Code
class Solution {
public:
int minDistance(string word1, string word2) {
int m = word1.length();
int n = word2.length();

vector> dp(m+1, vector(n+1));

for (int i = 0; i <= m; i++) {
dp[i][0] = i;
}

for (int j = 0; j <= n; j++) {
dp[0][j] = j;
}

for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++) {
if (word1[i-1] == word2[j-1]) {
dp[i][j] = dp[i-1][j-1];
} else {
dp[i][j] = 1 + min({dp[i][j-1], dp[i-1][j], dp[i-1][j-1]});
}
}
}

return dp[m][n];
}
};

Try solving now

2. GCD Sum

Hard
35m average time
55% success
0/120
Asked in companies
AdobeDunzoQuikr

Consider all numbers from 1 to ‘N’, your task is to find the sum of gcd of all pairs (i, j) such that 1 <= i < j <= N.

For example for N = 3, all pairs are { (1, 2), (1, 3), (2, 3) }.

Note :

Gcd of two numbers (X, Y) is defined as the largest integer that divides both ‘X’ and ‘Y’. 
Problem approach

#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;
}

Try solving now
02
Round
Easy
Video Call
Duration60 mins
Interview date1 Sep 2022
Coding problem1

1. Check Permutation

Easy
15m average time
85% success
0/40
Asked in companies
OptumGrabUber

You have been given two strings 'STR1' and 'STR2'. You have to check whether the two strings are anagram to each other or not.

Note:
Two strings are said to be anagram if they contain the same characters, irrespective of the order of the characters.
Example :
If 'STR1' = “listen” and 'STR2' = “silent” then the output will be 1.

Both the strings contain the same set of characters.
Problem approach

class Solution {
public:
bool isAnagram(string s, string t) {
int arr[256]={0};
for(int i=0;i {
arr[s[i]]++;
}
for(int i=0;i {
arr[t[i]]--;
}
for(int i=0;i<256;i++)
if(arr[i]!=0)
return false;

return true;
}
};

Try solving now
03
Round
Easy
Video Call
Duration60 mins
Interview date2 Sep 2022
Coding problem2

1. Integer To Roman Numeral

Easy
10m average time
90% success
0/40
Asked in companies
AdobeFacebookPayPal

Given an integer ‘N’, the task is to find its corresponding Roman numeral.

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.

Symbol      Value
  I           1
  V           5
  X           10
  L           50
  C           100
  D           500
  M           1000

Example :

2 is written as II in the roman numeral, just two one’s added together. 
12 is written as XII, which is simply X(ten) + II(one+one). 
The number 27 is written as XXVII, which is XX + V + II.

Roman numerals are usually written largest to smallest from left to right. 
However, the numeral for four is not IIII. Instead, the number four is written as IV. Because the one is before the five we subtract it making four.
The same principle applies to the number nine, which is written as IX.

There are six instances where subtraction is used:

I can be placed before V (5) and X (10) to make 4 and 9.
X can be placed before L (50) and C (100) to make 40 and 90.
C can be placed before D (500) and M (1000) to make 400 and 900.
Problem approach

class Solution {
public:
string intToRoman(int num) {
vector roman({"I","IV","V","IX","X","XL","L","XC","C","CD","D","CM","M"});
vector number({1,4,5,9,10,40,50,90,100,400,500,900,1000});
int size=roman.size()-1;
string ans="";
while(num>0)
{
while(number[size]<=num)
{
ans+=roman[size];
num-=number[size];
}
size--;
}
return ans;
}
};

Try solving now

2. Heap Sort

Easy
15m average time
85% success
0/40
Asked in companies
AdobeExpedia GroupAmazon

You are given an array ‘ARR’ consisting of 'N' integers, and your task is to sort the given array in non-decreasing order using the Heap sort algorithm.

Problem approach

I was not able to implement this during my interview

Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

What is recursion?

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
3 rounds | 4 problems
Interviewed by BYJUS
804 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 8 problems
Interviewed by BYJUS
641 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by BYJUS
671 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by BYJUS
585 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Amazon
15481 views
4 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
15339 views
1 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Amazon
10142 views
2 comments
0 upvotes