Josh Technology Group interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

Josh Technology Group
upvote
share-icon
7 rounds | 17 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6+ months
Topics: Data Structures, Trees, Linked List, DP, Graphs
Tip
Tip

Tip 1 : Practice as many questions as you can
Tip 2 : Always try to optimize (space and time both) your solution
Tip 3 : Think twice before you start to write your code.

Application process
Where: Campus
Eligibility: Above 5 CGPA
Resume Tip
Resume tip

Tip 1 : It is better to have at least 2 projects in resume
Tip 2 : Be sure of what you wright in your resume

Interview rounds

01
Round
Easy
Online Coding Interview
Duration50 minutes
Interview date3 Sep 2022
Coding problem4

It was completely objective based.

1. MCQ Question

#include int a=10;int main(){ int a=20; cout<<::a; return 0;}The output of this program isOptions- Syntax error- 10 20- 20 10- 20 20

Problem approach

Ans:- 20 10 

The above program can have same name for local and global variables but value of local variable inside a function will take preference. When the above code is compiled and executed, it produces the following result:
2010

2. MCQ Question

#include  using namespace std;class Base1 { public:     Base1()     { cout << " Base1's constructor called" << endl;  }};  class Base2 { public:     Base2()     { cout << "Base2's constructor called" << endl;  }};  class Derived: public Base1, public Base2 {   public:     Derived()     {  cout << "Derived's constructor called" << endl;  }};  int main(){   Derived d;   return 0;}(A)Base1's destructorBase2's destructorDerived's destructor(B)Derived's destructorBase2's destructorBase1's destructorC) Compiler Dependent

Problem approach

Answer: (B)

Explanation: Destructors are always called in reverse order of constructors

3. Output Question

#include int main(){    int x = 80;     int y& = x;    x++;    cout << x << " " << --y;    return 0;}Options :- [A]. The program will print the output 80 80.[B]. The program will print the output 81 80.[C]. The program will print the output 81 81.[D]. It will result in a compile time error

Problem approach

Ans D
Answer is D as Y is storing the address of X, so --Y will result in error.

4. MCQ Question

#include enum bix{    a=1, b, c};int main(){    int x = c;    int &y = x;    int &z = x;    y = b;    cout<< z--;    return 0; }Options :- [A]. It will result in a compile time error.[B]. The program will print the output 1.[C]. The program will print the output 2[D]. The program will print the output 3.

Problem approach

Ans : - C

x=3
y=3
z=3

y=2 i.e.
x=2 i.e.
z=2

And decrement operator will effect only after the output !

Thus output = 2.

But z = 1.

02
Round
Easy
Online Coding Test
Duration75 minutes
Interview date3 Sep 2022
Coding problem3

consisted of 3 coding questions and 1 output based question

1. Find K-th smallest Element in BST

Easy
15m average time
85% success
0/40
Asked in companies
SAP LabsGoldman SachsVisa

Given a binary search tree and an integer ‘K’. Your task is to find the ‘K-th’ smallest element in the given BST( binary search tree).

BST ( binary search tree) -

If all the smallest nodes on the left side and all the greater nodes on the right side of the node current node.

Example -

alt text

Order of elements in increasing order in the given BST is - { 2, 3, 4, 5, 6, 7, 8, 10 }

Suppose given ‘K = 3’ then 3rd smallest element is ‘4’.

Suppose given ‘K = 8’ then 8th smallest element is ‘10’.

Note:
1. You are not required to print the output explicitly, it has already been taken care of. Just implement the function and return the ‘K-th’ smallest element of BST.
2. You don’t need to return ‘K-th’ smallest node, return just value of that node. 
3. If ‘K-th’ smallest element is not present in BST then return -1.
Try solving now

2. Closest Binary Search Tree Value

Easy
15m average time
85% success
0/40
Asked in companies
AdobeAccoliteJosh Technology Group

You have been given a binary search tree of integers with ‘N’ nodes and a target integer value ‘K’. Your task is to find the closest element to the target ‘K’ in the given binary search tree.

A node in BST is said to be the closest to the target if its absolute difference with the given target value ‘K’ is minimum. In the case of more than one closest element, return the element with a minimum value.

A binary search tree (BST) is a binary tree data structure with the following properties.

• The left subtree of a node contains only nodes with data less than the node’s data.

• The right subtree of a node contains only nodes with data greater than the node’s data.

• Both the left and right subtrees must also be binary search trees.
For Example:

example

For the given BST and target value ‘K’ =  32, the closest element is 30 as the absolute difference between 30 and 32 (|32 - 30|) is the minimum among all other possible node-target pairs.
Try solving now

3. Anagram Pairs

Moderate
30m average time
60% success
0/80
Asked in companies
AdobeThought WorksHSBC

You are given two strings 'str1' and 'str1'.


You have to tell whether these strings form an anagram pair or not.


The strings form an anagram pair if the letters of one string can be rearranged to form another string.

Pre-requisites:

Anagrams are defined as words or names that can be formed by rearranging the letters of another word. Such as "spar" can be formed by rearranging letters of "rasp". Hence, "spar" and "rasp" are anagrams. 

Other examples include:

'triangle' and 'integral'
'listen' and 'silent'
Note:
Since it is a binary problem, there is no partial marking. Marks will only be awarded if you get all the test cases correct. 
Try solving now
03
Round
Medium
Online Coding Test
Duration75 minutes
Interview date3 Sep 2022
Coding problem3

consisted of 3 medium level coding questions

1. Remove Duplicates From Sorted List

Easy
0/40
Asked in companies
AdobeAppleAmazon

A doubly-linked list is a data structure that consists of sequentially linked nodes, and the nodes have reference to both the previous and the next nodes in the sequence of nodes.


You are given a sorted doubly linked list of size 'n'.


Remove all the duplicate nodes present in the linked list.


Example :
Input: Linked List: 1 <-> 2 <-> 2 <-> 2 <-> 3

Output: Modified Linked List: 1 <-> 2 <-> 3

Explanation: We will delete the duplicate values ‘2’ present in the linked list.


Try solving now

2. Minimum Cost To Make String Valid

Moderate
20m average time
80% success
0/80
Asked in companies
MicrosoftAdobeAmazon

Ninja has been given a string ‘STR’ containing either ‘{’ or ‘}’. 'STR’ is called valid if all the brackets are balanced. Formally for each opening bracket, there must be a closing bracket right to it.

For Example:
“{}{}”, “{{}}”, “{{}{}}” are valid strings while “}{}”, “{}}{{}”, “{{}}}{“ are not valid strings.

Ninja wants to make ‘STR’ valid by performing some operations on it. In one operation, he can convert ‘{’ into ‘}’ or vice versa, and the cost of one such operation is 1.

Your task is to help Ninja determine the minimum cost to make ‘STR’ valid.

For Example:
Minimum operations to make ‘STR’ =  “{{“ valid is 1.

In one operation, we can convert ‘{’ at index ‘1’ (0-based indexing) to ‘}’. The ‘STR’ now becomes "{}" which is a valid string.

Note:
Return -1 if it is impossible to make ‘STR’ valid.
Try solving now

3. Reverse Nodes in k-Group

Hard
56m average time
30% success
0/120
Asked in companies
SAP LabsHikeAdobe

You are given a Singly Linked List of integers and an integer array 'B' of size 'N'. Each element in the array 'B' represents a block size. Modify the linked list by reversing the nodes in each block whose sizes are given by the array 'B'.

Note:
1. If you encounter a situation when 'B[i]' is greater than the number of remaining nodes in the list, then simply reverse the remaining nodes as a block and ignore all the block sizes from 'B[i]'. 

2. All block sizes are contiguous i.e. suppose that block 'B[i]' ends at a node cur, then the block 'B[i+1]' starts from the node just after the node cur.
Example
Linked list: 1->2->3->4->5
Array B: 3 3 5

Output: 3->2->1->5->4

We reverse the first block of size 3 and then move to block 2. Now, since the number of nodes remaining in the list (2) is less than the block size (3), we reverse the remaining nodes (4 and 5) as a block and ignore all the block sizes that follow.
Try solving now
04
Round
Easy
Video Call
Duration60 minutes
Interview date10 Sep 2022
Coding problem2

1st interview was early in the morning.
Interviewer asked for a basic introduction followed by 2 questions.
For coding questions you need to first discuss the approach with the interviewer only when the interviewer is satisfied with your approach, the interviewer will ask you to code. 
Questions were of easy level

1. Maximum Subarray Sum

Moderate
0/80
Asked in companies
IntuitAmazonOracle

You are given an array/list ARR consisting of N integers. Your task is to find the maximum possible sum of a non-empty subarray(contiguous) of this array.

Note: An array C is a subarray of array D if it can be obtained by deletion of several elements(possibly zero) from the beginning and the end of array D.

For e.g.- All the non-empty subarrays of array [1,2,3] are [1], [2], [3], [1,2], [2,3], [1,2,3].

Try solving now

2. Subtree of Another Tree

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

Given two binary trees T and S, check whether tree S has exactly the same structure and node values with a subtree of T, i.e., check if tree S is a subtree of the tree T.

A subtree of a tree T is a tree S consisting of a node in T and all of its descendants in T. The subtree corresponding to the root node is the entire tree; the subtree corresponding to any other node is called a proper subtree.

Try solving now
05
Round
Medium
Video Call
Duration90 minutes
Interview date10 Sep 2022
Coding problem2

For coding questions you need to first discuss the approach with the interviewer only when the interviewer is satisfied with your approach, the interviewer will ask you to code.

1. Convert A Given Binary Tree To Doubly Linked List

Moderate
15m average time
80% success
0/80
Asked in companies
LinkedInFacebookRazorpay

Given a Binary Tree, convert this binary tree to a Doubly Linked List.

A Binary Tree (BT) is a data structure in which each node has at most two children.

A Doubly Linked List contains a previous pointer, along with the next pointer and data.

The order of nodes in Doubly Linked List must be the same as Inorder of the given Binary Tree.

The doubly linked list should be returned by taking the next pointer as right and the previous pointer as left.

You need to return the head of the Doubly Linked List.

For the given binary tree :

alt txt

You need to return the head to the doubly linked list.
The doubly linked list would be: 1 2 3 4 5 and can be represented as:

alt txt

Try solving now

2. All Root to Leaf Paths In Binary Tree.

Moderate
25m average time
70% success
0/80
Asked in companies
AmazonInfo Edge India (Naukri.com)Mathworks

You are given an arbitrary binary tree consisting of 'N' nodes numbered from 1 to 'N'. Your task is to print all the root to leaf paths of the binary tree.

A leaf of a binary tree is the node which does not have a left child and a right child.


For Example :
Given a binary tree :

alt txt

All the root to leaf paths are :
1 2 4
1 2 5 
1 3

Note :

1. Two nodes may have the same value associated with it.
2. The root node will be fixed and will be provided in the function.
3. Note that the nodes in a path will appear in a fixed order. For example, 1 2 3 is not the same as 2 1 3.
4. Each path should be returned as a string consisting of nodes in order and separated by a space.
5. The path length may be as small as ‘1’.
Try solving now
06
Round
Hard
Video Call
Duration150 minutes
Interview date10 Sep 2022
Coding problem2

The interview started with a basic introduction, some discussion on projects, my journey till now and finally 2 coding questions were asked.Interviewer will make you dry run your code on provided test cases for every coding question in every interview .

As all three interviews were scheduled on the same day, giving 3rd round of approx 2.5 hrs with the same energy and mindset made it a bit difficult. Also the level of questions that were asked was higher than the first 2 interviews.
Try not to mug up things before the interview, that will only make things stressful.
Be calm and relax.

The interviewers were helpful and so you can ask for hints if stuck anywhere.

1. Pair Sum in BST.

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

You are given a Binary Search Tree (BST) and a target value ‘K’. Your task is to return true if there exist two nodes in the given BST such that the sum of their values is equal to the given target ‘K’, else return false.


A binary search tree (BST) is a binary tree data structure which has the following properties.

• The left subtree of a node contains only nodes with data less than the node’s data.

• The right subtree of a node contains only nodes with data greater than the node’s data.

• Both the left and right subtrees must also be binary search trees.


Note:
1. All the elements of the Binary Search Tree are unique.

2. You can’t use the same node value/element of BST twice.


For example:
tree: 8 5 10 2 6 -1 -1 -1 -1 -1 7 -1 -1
'K' = 13,

The nodes with values 8 and 5 as shown in the above figure gives sum equal to the given target 13. 

Therefore, the output will be “true” i.e it is possible to find a pair in the given BST having sum equal to ‘K’.
Try solving now

2. Pair sum in a BST

Easy
15m average time
80% success
0/40
Asked in companies
AmazonSamsungMicrosoft

You are given a binary search tree and an integer ‘S’. Your task is to find all the pairs of nodes in the BST which sum to the value ‘S’. If no such pair exists, then print -1 - 1.

Note:

You can use extra space of the order of not more than O(log n).

A binary search tree (BST) is a binary tree data structure which has the following properties.
• The left subtree of a node contains only nodes with data less than the node’s data.
• The right subtree of a node contains only nodes with data greater than the node’s data.
• Both the left and right subtrees must also be binary search trees.

Note:

1. All the elements of the Binary Search Tree are unique.
2. You can’t use the same node value/element of BST twice.
Try solving now
07
Round
Easy
HR Round
Duration20 minutes
Interview date10 Sep 2022
Coding problem1

HR round was on the same day, and was short and non technical.

1. Basic HR Questions

some basic questions like why do you want join JTG, how were the interviews and are there any suggestions or queries were asked.

Problem approach

Be confident and sure of what you say

Here's your problem of the day

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

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Josh Technology Group
1521 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Josh Technology Group
1027 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 3 problems
Interviewed by Josh Technology Group
1485 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 7 problems
Interviewed by Josh Technology Group
1160 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
2 rounds | 3 problems
Interviewed by BNY Mellon
6365 views
3 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by BNY Mellon
0 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by CIS - Cyber Infrastructure
2197 views
0 comments
0 upvotes