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

SDE - Intern

Hike
upvote
share-icon
1 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 2 months
Topics: Data Structure,OOPS, Java, Graphs, Pointers
Tip
Tip

Tip 1 : Do at least 1 project.
Tip 2 : Practice data structure questions.
Tip 3 : Dynamic programming is must.

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

Tip 1 : Do not put false things.
Tip 2 : Keep it short and direct.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date12 Feb 2021
Coding problem4

Timing was 10AM. The platform was quite good.

1. Maximum size rectangle sub-matrix with all 1's

Hard
10m average time
80% success
0/120
Asked in companies
AmazonGoogleApple

You are given an 'N' * 'M' sized binary-valued matrix 'MAT, where 'N' is the number of rows and 'M' is the number of columns. You need to return the maximum size (area) of the submatrix which consists of all 1’s i.e. the maximum area of a submatrix in which each cell has only the value ‘1’.

subMatrix_image

In the above image, areas in green, red, and violet color are all submatrices of the original 4x4 matrix.

Note:

1. Binary valued matrix has only two values in each cell : 0 and 1.
2. A submatrix is a matrix formed by selecting certain rows and columns from a larger matrix.
3. The area of a matrix with 'h' rows and 'w' columns is equal to 'h' * 'w'. 
Problem approach

If the height of bars of the histogram is given then the largest area of the histogram can be found. This way in each row, the largest area of bars of the histogram can be found. To get the largest rectangle full of 1’s, update the next row with the previous row and find the largest area under the histogram, i.e. consider each 1’s as filled squares and 0’s with an empty square and consider each row as the base.

Try solving now

2. Maximum Sum path of a binary tree.

Hard
25m average time
75% success
0/120
Asked in companies
HikeInfosysSamsung

You are given a binary tree having 'n' nodes. Each node of the tree has an integer value.


Your task is to find the maximum possible sum of a simple path between any two nodes (possibly the same) of the given tree.


A simple path is a path between any two nodes of a tree, such that no edge in the path is repeated twice. The sum of a simple path is defined as the summation of all node values in a path.

Problem approach

For each node there can be four ways that the max path goes through the node:
1. Node only
2. Max path through Left Child + Node
3. Max path through Right Child + Node
4. Max path through Left Child + Node + Max path through Right Child

Try solving now

3. Minimum number of swaps required to sort an array

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

You have been given an array 'ARR' of 'N' distinct elements.

Your task is to find the minimum no. of swaps required to sort the array.

For example:
For the given input array [4, 3, 2, 1], the minimum no. of swaps required to sort the array is 2, i.e. swap index 0 with 3 and 1 with 2 to form the sorted array [1, 2, 3, 4].
Problem approach

This can be easily done by visualizing the problem as a graph. We will have n nodes and an edge directed from node i to node j if the element at i’th index must be present at j’th index in the sorted array.

Try solving now

4. Prefix to Infix

Easy
10m average time
90% success
0/40
Asked in companies
HikeInfo Edge India (Naukri.com)Samsung

You are given a string denoting a valid Prefix expression containing ‘+’, ’-’, ’*’, ‘/’ and lowercase letters.


Convert the given Prefix expression into an Infix expression.


Note:
Infix notation is a method of writing mathematical expressions in which operators are placed between operands. For example, "a + b" represents the addition of a and b.

Prefix notation is a method of writing mathematical expressions in which operators are placed before the operands. For example, "+ a b" represents the addition of a and b.

Expression contains lowercase English letters, ‘+’, ‘-’, ‘*’, and  ‘/’. 


Example:
Input: /-ab+-cde

Output: ((a-b)/((c-d)+e))

Explanation:
In this test case, there are four operators ‘/’, ‘-’, ‘+’, ‘-’.
Prefix expression:  /-ab+-cde. 
The operator between  ‘a’ and ‘b’ is ‘-’. Resulting expression: /(a-b)+-cde.
The operator between  ‘c’ and ‘d’ is ‘-’. Resulting expression: /(a-b)+(c-d)e.
The operator between ‘c-d’ and ‘e’ is +. Resulting expression: /(a-b)((c-d)+e).
The operator between ‘a-b’ and ‘((c-d)+e)’ is ‘/’. Resulting expression: ((a-b)/((c-d)+e)).
Problem approach

Algorithm for Prefix to Infix:

Read the Prefix expression in reverse order (from right to left)
If the symbol is an operand, then push it onto the Stack
If the symbol is an operator, then pop two operands from the Stack
Create a string by concatenating the two operands and the operator between them.
string = (operand1 + operator + operand2)
And push the resultant string back to Stack
Repeat the above steps until end of Prefix expression.

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

How do you create a function in JavaScript?

Choose another skill to practice
Start a Discussion
Similar interview experiences
company logo
SDE - Intern
2 rounds | 2 problems
Interviewed by Hike
789 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 4 problems
Interviewed by Hike
810 views
0 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Hike
1296 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 7 problems
Interviewed by Hike
370 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Amazon
13596 views
4 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
12783 views
1 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Amazon
9049 views
2 comments
0 upvotes