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

SDE - 1

HCL Technologies
upvote
share-icon
2 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Journey
I started my journey in coding from second year after being motivated from my seniors. I initially started my journey by learning basic programming languages. Later, I started giving contests on code forces and solving questions on it. I kept trying to be consistent in doing so. After 2-3 months I was able to solve some questions on code forces. Then in my third year, I studied core subjects like OS, DBMS, OOPS and CN in depth. In this manner, I was well prepared before the placement season.
Application story
This company visited to my campus the placement .
Why selected/rejected for the role?
i was rejected because i was not able to maintain the timing of the questions to be answer i should be more fast.
Preparation
Duration: 4 months
Topics: Data Structures, Pointers, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : Practice coding from Leetcode, Interview bit, at least 100 questions 
Tip 2 : Practice any one automation framework includes design patterns

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

Tip 1 : Restrict your resume to 1 page and write your practical work only
Tip 2 : Mention top topics like Selenium, Rest Assured Automation, Language used Java etc

Interview rounds

01
Round
Medium
Video Call
Duration90 mins
Interview date17 Nov 2022
Coding problem3

1. DFS Traversal

Moderate
35m average time
65% success
0/80
Asked in companies
SamsungIntuitGoldman Sachs

Given an undirected and disconnected graph G(V, E), containing 'V' vertices and 'E' edges, the information about edges is given using 'GRAPH' matrix, where i-th edge is between GRAPH[i][0] and GRAPH[i][1]. print its DFS traversal.

V is the number of vertices present in graph G and vertices are numbered from 0 to V-1. 

E is the number of edges present in graph G.
Note :
The Graph may not be connected i.e there may exist multiple components in a graph.
Problem approach

Use simple recursion approach to solve this

Try solving now

2. Invert a Binary Tree

Moderate
45m average time
55% success
0/80
Asked in companies
AppleSamsungFreshworks

You are provided with a Binary Tree and one of its leaf nodes. You have to invert this binary tree. Inversion must be done by following all the below guidelines:

• The given leaf node becomes the root after the inversion.

• For a node (say, ‘x’) 
    ○ If there exists the left child that is not yet taken then this child must become the right child of ‘x’.
    ○ If the left child is already taken then the right child is still on the right side of ‘x’.

• The parent of ‘x’ must be the left child of ‘x’.

For Example:

Example-img01
Example-img02

Consider the above binary tree (image- before inversion), if the given leaf node is ‘1’ then the binary tree after inversion becomes exactly the same as given in the image representing after inversion.

Note:

The given binary tree will only have distinct values of nodes.

Problem approach

You are provided with a Binary Tree and one of its leaf nodes. You have to invert this binary tree.

Try solving now

3. Maximum In Sliding Windows Of Size K

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

Given an array/list of integers of length ‘N’, there is a sliding window of size ‘K’ which moves from the beginning of the array, to the very end. You can only see the ‘K’ numbers in a particular window at a time. For each of the 'N'-'K'+1 different windows thus formed, you are supposed to return the maximum element in each of them, from the given array/list.

Problem approach

The idea is to maintain a maxHeap of size k. A number is to be evicted from this heap if the k-sized window moves past it.
-> If that number to be evicted is at the top, immediately pop the heap.
-> if not, then maintain a toDelete heap which will evict the number as soon as it reaches top in both. Keep discarding numbers from both these heaps until the tops don't match.

Try solving now
02
Round
Easy
Video Call
Duration90 mins
Interview date17 Nov 2022
Coding problem3

1. Edit Distance

Moderate
30m average time
70% success
0/80
Asked in companies
OYOGoldman SachsHCL Technologies

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

Firstly I gave the interviewer, a recursive solution then he asked me to reduce complexity as it was exponential of recursive solution so I gave him a top-down DP solution.

Try solving now

2. Partition Array for Maximum Sum

Moderate
0/80
Asked in companies
SamsungHCL Technologies

You are given an array 'arr' of 'n' integers.


You have to divide the array into some subarrays such that each element is present in exactly one of the subarrays.


The length of each subarray should be at most 'k'. After partitioning all the elements of each subarray will be changed to the maximum element present in that subarray.


Find the maximum possible sum of all the elements after partitioning.


Note:

Input is given such that the answer will fit in a 32-bit integer.


Example:
Input: 'k' = 3, 'arr' = [1, 20, 13, 4, 4, 1]

Output: 80

Explanation:
We can divide the array into the following subarrays
[1,20] max of this subarray is 20 so the contribution of 
this subarray in the final answer will be 20*2=40.
[13,4,4]  max of this subarray is 13 so the contribution of 
this subarray in the final answer will be 13*3=39.
[1]  max of this subarray is 1 so the contribution of this 
subarray in the final answer will be 1*1=1.

So, the answer will be 40 + 39 + 1 = 80.


Problem approach

Use dynamic Programming. This is just a variation of the MCM problem and can be understood just by building a recursion tree as we generally do for MCM-type problems. It is a standard problem, just we need to identify the pattern.

Try solving now

3. Shortest Common Supersequence

Hard
25m average time
0/120
Asked in companies
Dream11SamsungHCL Technologies

Given two strings, ‘A’ and ‘B’. Return the shortest supersequence string ‘S’, containing both ‘A’ and ‘B’ as its subsequences. If there are multiple answers, return any of them.

Note: A string 's' is a subsequence of string 't' if deleting some number of characters from 't' (possibly 0) results in the string 's'.

For example:
Suppose ‘A’ = “brute”, and ‘B’ = “groot”

The shortest supersequence will be “bgruoote”. As shown below, it contains both ‘A’ and ‘B’ as subsequences.

A   A A     A A
b g r u o o t e
  B B   B B B  

It can be proved that the length of supersequence for this input cannot be less than 8. So the output will be bgruoote.
Problem approach

For every string s we pre-calculate the length of the longest possible overlap between s and any other strings. 

Then for every possible subset A'of A, we could use the sum of the precalculated lengths as an upper bound to the total overlaps that can be obtained by combining all the strings in A'. 

Using this upper bound, we could give up early on many branches.

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 remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
2 rounds | 6 problems
Interviewed by HCL Technologies
1250 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 6 problems
Interviewed by HCL Technologies
0 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by HCL Technologies
1496 views
4 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by HCL Technologies
2260 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