KLA | 4+ YOE | Chennai | 1st round | DSA

kla logo
kla
Chennai4 years
April 15, 202513 reads

Summary

I interviewed for a programming round at KLA in Chennai, focusing on Data Structures and Algorithms. The round involved solving three specific problems on a HackerRank portal.

Full Experience

Recuriter reached out to me through naukri. 1st round was programming round. Need to solve the presented problems on hackerrank portal(intellisence is available) and discuss the solution with the interviewer.

Interview Questions (3)

Q1
Absolute Difference of Alpha and Beta in Array
Data Structures & Algorithms

Given an array of positive integers, return the absolute difference between alpha and beta of the array.

Alpha : No of times an element 'k' appears exactly 'k' consecutive times.
Beta : No of times an element 'k' appears exactly 'k' consecutive times starting at index k. (1-based indexing)

example:
input: arr=[2,2,2,4,4,4,4,3,3,3,2,2]
output: 2 (|3-1|)

Aplha - 3 (3 instances - 4,3,2)
Beta - 1 (only one instance - element 4 appears 4 times consecutively starting at index 4).

Q2
Smallest Missing Number from Subsequence ORs
Data Structures & Algorithms

Given an array of whole numbers, Find the lowest whole number which is not present in the list of the whole numbers obtained by performing the bitwise OR operation on all of the subsequences of the array.

example:
input: [1,3,4,0]
output: 2

[0] => 0
[4] => 4
[4, 0] => 4
[3] => 3
[3, 0] => 3
[3, 4] => 7
[3, 4, 0] => 7
[1] => 1
[1, 0] => 1
[1, 4] => 5
[1, 4, 0] => 5
[1, 3] => 3
[1, 3, 0] => 3
[1, 3, 4] => 7
[1, 3, 4, 0] => 7

2 is the smallest whole number which is not present in the result set.

Q3
Minimum Transfers to Measure X Liters
Data Structures & Algorithms

Given n jars with capacity of [c1,c2....cn] liters, and each jar containing intial water of [i1,i2....in] liters, Find the minimum no of transfers required to measure 'X' liters of water.

constraints:
2<= n <=4
(output) min no of transfers required <= 6

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!