HackWithInfy is an open contest of Infosys. It contains three rounds.

## Round 1

Round 1, contains three problem-solving coding questions hosted by HackerEarth. Three Questions of different difficulties. Easy for 50 points, Medium for 75 points, Hard for 100 points. Total of 225 points. I have solved only one coding question(Easy). In this round, we are able to see how many test cases are passed.

**Maximum Sum of all Triplets Score [ EASY]**

Given an array of length n, where n is multiple of 3. Construct n/3 triplets (a,b,c) such that a<=b<=c, then the score of the triplet is b (middle element), such that sum of all triplets score is maximum.

Ex: array = [ 4 , 2 , 3 , 1 , 5, 6 ] , 2 triplets t1 = [ 1 , 5 , 6] , t2 = [ 2 , 3 , 4] — > total score is 5 + 3 = 8

**Approach 1**

step 1: Sort the array

step 2 : consider 1 smallest and 2 large numbers have one triplet

step 3: sum of all the triplets score

**Approach 2**

step 1: create max heap

step 2: pop and pop the next largest and add it to the sum

step 3: repeat this step 2 for n/3 times

**Round 2**

Round 2, contains three problem-solving coding questions hosted by HackerEarth. Three Questions of different difficulties. Easy for 50 points, Medium for 75 points, Hard for 100 points. Total of 225 points. I have solved two coding questions(Easy, medium). In this round, we are not able to see how many test cases are passed.

**Maximum Number of cities can be visited [EASY]**

Given N cities, and exist N-1 roads (bi-directional), such that all cities are can be visited through these roads. There are M devils, they sit in m different cities. Everyone is afraid of the devil so that we cannot visit that city. Find the maximum number of cities that can be visited from city “1”. Given N cities, and N-1 roads between city X and city Y. M devil, on which city they sit.

Example: 10 cities

roads between city X and City Y

1 2

1 3

1 4

2 5

2 6

3 8

3 7

4 9

8 10

3 devils sat on city 2, 8, 9

output : 3

we can visit 3, 7, 4

**Approach**

- construct a graph
- Traverse DFS or BFS and count Number of Cities can be visited

**Maximum of Student Groups can Satisfy [ MEDIUM ]**

Given N student groups, group size may vary and M different radius ball groups, group size may vary. A student group is said to be satisfied if, in each group have different radius balls and each student has at least one ball. The ball’s position is the radius of the ball.

Ex: Student groups [ 1, 2, 3]

Balls [ 2, 2, 2]

Balls with radius 1 are 2

Balls with radius 2 are 2

Balls with radius 3 are 3

Output : 3

Explanation:

for Student group 1 –> size 1, can have a ball with radius 1 remaining [ 1, 2, 2]

for student group 2 — > size 2, can have balls with radius 2 and 3 remaining [1, 1, 1 ]

for student group 3 –> size 3, can have balls with radius 1, 2, and 3 remaining [ 0, 0, 0 ]

All student groups are Satisfied

.

.

Top 108 participants are selected for Hackathon [ Round 3]. I am not in Top 108 participants

**Interviews****Round 1 TR (Time 50 mins to 1 Hour)**

It is a virtual interview hosted on Cisco Webex.

Interviewer: Tell me about yourself

Me: answered

Interviewer: favorite programming language

Me: Python

Interviewer: Python vs Java

Me: answered

Interviewer: share your screen, and write a program that reads a word and determine how many words, with the same number of letters as the input, it might represent.

example

input: ETA

output: 7

explanation

ETA can be represented as **. – . –**

ETA — > **. – . –**

ETET — > **. – . –**

AET — >** . – . –**

ENA — >** . – . –**

EK –>** . – . –**

AA — > **. – . –**

RT — > **. – . –**

Me: Explained approach use Recursion and written code using memorization of recursion results

We ended the interview

**Round 2 TR (15 mins)**

Interviewer: Tell me about yourself

Me: answered

Interviewer: Process vs Thread

Me: answered

the interviewer asked about some personal questions

We ended the Interview

After ten days I have received mail

**Result: Selected**

Thankyou for Reading