HackWithInfy is a coding competition organized by Infosys, a global technology company based in India, for second-year to pre-final year students across India. The competition tests participants' coding abilities by challenging them to solve a set of questions within a given time frame. The top performers in the competition are then given the opportunity to interview with Infosys for potential job or internship opportunities. It's a good platform for students to showcase their coding and problem solving skills, and also for Infosys to identify and recruit top talent.
Please note that meeting the above criteria does not guarantee participation, as the number of participants is based on the capacity and final selection will be done by the company.
The Syllabus for HackWithInfy coding round includes the following topics:
The round comprises 3 questions that participants have to solve within a time limit of 3 hours. To be selected for the next round, participants should aim to solve at least 1-2 coding questions. The difficulty level of the questions is medium-high.
Exam pattern for HackWithInfy typically consists of the following rounds:
Round 1: 3 coding questions of varying difficulty levels that can be completed on any coding platform. These questions will test participants' coding abilities and problem-solving skills.
Round 2: A live grand finale event, held at one of Infosys' campuses. The top 100 participants will be invited to participate in a team-based hackathon event, where they will work together to solve a set of coding challenges.
Technical Interview: Following the online test and hackathon event, the top performers will be invited to participate in a technical interview with Infosys. This interview will assess the participant's coding skills and problem solving ability, their resume, Data structure and Algorithm knowledge, and latest technology and programming knowledge.
Based on the performance in the exam pattern and interview, candidates of HackWithInfy will be offered jobs on various profiles within Infosys. These profiles include:
It is to note that based on the interview, candidates may also be considered for the role of a System Engineer if they did not perform well in the online test round. Additionally, the company may offer 2-3 chances for different roles to the candidates who performed averagely in the interview.
It is also important to note that only the top 100 candidates will be invited for Power Programmer interviews as the company would be highly selective in selecting the Power Programmer profile.
#Question 1
Suppose you are given a sequence of N different types of fruits arranged in a row, where each fruit represents a type of dish. Your task is to find the maximum number of fruits you can pick while satisfying the following conditions:
What type of fruit should you choose to achieve the maximum number of fruits?
#Question 1
Given a positive integer N, write a function to determine the number of bases between 2 and N (inclusive) in which the representation of N starts with the digit 1.
#Solution 1
```sh
def count_bases(N: int) -> int:
count = 0
for base in range(2, N+1):
if int(str(N)[0]) == 1:
count += 1
return count
```
#Question 2
Given a list of positive integers, write a function to find the number of bases in which the representation of each integer in the list starts with the digit 1.
#Solution 2
```sh
def count_bases_list(lst: List[int]) -> int:
count = 0
for num in lst:
for base in range(2, num+1):
if int(str(num)[0]) == 1:
count += 1
return count
```
#Question 2
You are given three stacks of blocks, where the first stack contains A blocks, the second stack contains B blocks, and the third stack contains C blocks. Your task is to determine if it is possible to move blocks from one stack to the other two stacks such that the final two stacks have X and Y blocks, respectively. To move the blocks, you must choose one stack, take some number of blocks from it, and move them to the other two stacks, such that one stack has k blocks and the other stack has s-k blocks.
#Question 3
Given a string that represents a number in a certain base, write a function to determine the next number in the sequence that starts with 1 in that base.
#Solution 3
```sh
def next_num_base(s: str, base: int) -> str:
num = int(s, base)
while True:
num += 1
if str(num)[0] == "1":
return str(num)
```
#Question 3
Altaf has recently learned about number bases and is becoming fascinated.
Altaf learned that for bases greater than ten, new digit symbols need to be introduced, and that the convention is to use the first few letters of the English alphabet. For example, in base 16, the digits are 0123456789ABCDEF. Altaf thought that this was unsustainable; the English alphabet only has 26 letters, so this scheme can only work up to base 36. But this is no problem for Altaf, because Altaf is very creative and can just invent new digit symbols when she needs them. (Altaf is very creative.)
Altaf also noticed that in base two, all positive integers start with the digit 1! However, this is the only base where this is true. So naturally, Altaf wonders: Given some integer N, how many bases b are there such that the base-b representation of N starts with a 1?
#Question 4
Given an integer N, write a function that returns all the bases between 2 and N inclusive for which representation of N starts with the digit 1
#Solution 4
```sh
def bases_with_1(N: int) -> List[int]:
res = []
for base in range(2, N+1):
if int(str(N)[0]) == 1:
res.append(base)
return res
```
#Question 5
Given a List of integers and a target integer x, write a function that returns the number of bases between 2 and x inclusive for which representation of each element in the list starts with the digit 1
# Solution 5
```sh
def count_bases_list_and_target(lst: List[int], x: int) -> int:
count = 0
for num in lst:
for base in range(2, x+1):
if int(str(num)[0]) == 1:
count += 1
return count
```
I started practising on Edyst platform since my 3rd year of college focused on placements & always liked the way they helped us when we were stuck at a particular problem.
Thank you, Edyst for all the assistance and amazing support!
Being a mechanical student and getting into an IT company is very tough. One of the main reason I could able to crack TCS CodeVita is because of Edyst.
Aneeq sir, your doubt clearing sessions, daily assignments & incredible mentors support really brushed up my skills.
When I joined the Edyst courses I received personalized mentoring on how to crack coding rounds of different companies. Through a combination of coding skills and great projects, I received multiple offers above 6+ lakhs per annum. Finally I joined for 8+ Lakhs package. Thanks for all the support, from Edyst Team.
Edyst's training style completely resonated with me. I approached programming as more than a subject. Thanks to Edyst team for the guidance!
#Question 1
Suppose you are given a sequence of N different types of fruits arranged in a row, where each fruit represents a type of dish. Your task is to find the maximum number of fruits you can pick while satisfying the following conditions:
What type of fruit should you choose to achieve the maximum number of fruits?
#Question 1
Given a positive integer N, write a function to determine the number of bases between 2 and N (inclusive) in which the representation of N starts with the digit 1.
#Solution 1
```sh
def count_bases(N: int) -> int:
count = 0
for base in range(2, N+1):
if int(str(N)[0]) == 1:
count += 1
return count
```
#Question 2
Given a list of positive integers, write a function to find the number of bases in which the representation of each integer in the list starts with the digit 1.
#Solution 2
```sh
def count_bases_list(lst: List[int]) -> int:
count = 0
for num in lst:
for base in range(2, num+1):
if int(str(num)[0]) == 1:
count += 1
return count
```
#Question 2
You are given three stacks of blocks, where the first stack contains A blocks, the second stack contains B blocks, and the third stack contains C blocks. Your task is to determine if it is possible to move blocks from one stack to the other two stacks such that the final two stacks have X and Y blocks, respectively. To move the blocks, you must choose one stack, take some number of blocks from it, and move them to the other two stacks, such that one stack has k blocks and the other stack has s-k blocks.
#Question 3
Given a string that represents a number in a certain base, write a function to determine the next number in the sequence that starts with 1 in that base.
#Solution 3
```sh
def next_num_base(s: str, base: int) -> str:
num = int(s, base)
while True:
num += 1
if str(num)[0] == "1":
return str(num)
```
#Question 3
Altaf has recently learned about number bases and is becoming fascinated.
Altaf learned that for bases greater than ten, new digit symbols need to be introduced, and that the convention is to use the first few letters of the English alphabet. For example, in base 16, the digits are 0123456789ABCDEF. Altaf thought that this was unsustainable; the English alphabet only has 26 letters, so this scheme can only work up to base 36. But this is no problem for Altaf, because Altaf is very creative and can just invent new digit symbols when she needs them. (Altaf is very creative.)
Altaf also noticed that in base two, all positive integers start with the digit 1! However, this is the only base where this is true. So naturally, Altaf wonders: Given some integer N, how many bases b are there such that the base-b representation of N starts with a 1?
#Question 4
Given an integer N, write a function that returns all the bases between 2 and N inclusive for which representation of N starts with the digit 1
#Solution 4
```sh
def bases_with_1(N: int) -> List[int]:
res = []
for base in range(2, N+1):
if int(str(N)[0]) == 1:
res.append(base)
return res
```
#Question 5
Given a List of integers and a target integer x, write a function that returns the number of bases between 2 and x inclusive for which representation of each element in the list starts with the digit 1
# Solution 5
```sh
def count_bases_list_and_target(lst: List[int], x: int) -> int:
count = 0
for num in lst:
for base in range(2, x+1):
if int(str(num)[0]) == 1:
count += 1
return count
```
All Infosys HackWithInfy Questions
All Infosys HackWithInfy Questions