Convegenius Coding Questions and Answers

Convegenius Coding Questions with Solutions

This page will help you to find Sample Convegenius Coding Questions and Answers included Online Assessment and Technical Interview of the company which will help you to prepare for Convegenius Hiring Drive. Go through this page to get all the Sample Questions to prepare for Convegenius Hiring for freshers.

By the end of Convegenius Coding Questions and Answers page you’ll get FAQ’s related to Convegenius Hiring Process that will help you to get clear understanding of the recruitment drive.

Convengenius-Coding-Questions-with-Solutions

Convegenius Coding Questions with Solutions

Question 1: Detecting loop in a linked list

Problem Statement –  

You are given a singly linked list, where each node contains a value and a pointer to the next node in the list. Your task is to determine if the linked list contains a cycle or not.

A cycle in a linked list occurs when there is a node in the list whose next pointer points to a previously visited node, creating a loop.

You need to implement an efficient solution with a time complexity of O(n) and a space complexity of O(1), where n is the number of nodes in the linked list.

Function Description:

Complete the hasLoop function that takes the head of the linked list as input.

Returns true if a cycle exists, and false otherwise.

Constraints:

  • The number of the nodes in the list is in the range [1, 99].
  • -105 <= Node.val <= 105

Sample Cases:

Sample Input :

list = [1, 2, 3, 4]

loop at 4 -> 1

Sample Output :

After giving sample input the desired output will be as follows:

Loop Detected

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Question 2 : Weird Terminal

Problem Statement : 

Here is a weird problem in Susan’s terminal. He can not write more than two words each line, if she writes more than two, it takes only 2 words and the rest are not taken. So she needs to use enter and put the rest in a new line. For a given paragraph, how many lines are needed to be written in Susan’s terminal?

Input Format:

A string as the text to input in the terminal

Output Format:

Number of lines written.

Constraints:

Number of words <=10^7

Sample Input:

How long do you have to sit dear ?

Sample Output:

4

Explanation:

The writing will be:

How long

Do you

Have to

Sit dear ?

Question 3 : Device Name System

Problem statement: Rocky is a software engineer and he is creating his own operating system called “myFirst os”. myFirst os is a GUI (Graphical user interface) based operating system where everything is stored in files and folders. He is facing issues on  creating unique folder names for the operating system . Help rocky to create the unique folder name for it’s os.If folder name already exists in the system and integer number is added at the name to make it unique. The integer added starts with 1 and is incremented by 1 for each new request of an existing folder name. Given a list of folder names , process all requests and return an array of corresponding folder names.

Example 

  • n=5
  • foldername= [‘home’ , ‘myfirst’ ,’downloads’, ‘myfirst’, ‘myfirst’]
  • Foldername[0] = ‘home’ is unique.
  • Foldername[1] = ‘myfirst’ is unique.
  • foldername [2] =’downloads’ is unique.
  • Foldername[3] =’myfirst’ already exists in our system. So Add1 at the end of the folder name i.e foldername[3] =”myfirst1″
  • Foldername[4 ]=’myfirst’ also already exists in our system.So add 2 at the end of the folder name i.e. foldername[4]=”myfirst2″.

Function description 

  • Complete the function folderNameSystem In the editor below
  • folderNameSystem has the following parameters
  • string foldername[n]: an array of folder name string in the order requested

Returns:

  • String[n]:  an array of strings usernames in the order assigned

Constraints

  •     1<=n<=10^4
  •     1<=length of foldername[i]<20
  •     foldername[i] contains only lowercase english letter in the range ascii[a-z]

Input Format:

  • The first line contains an integer n , denoting the size of the array usernames Each line i of the n subsequent lines (where i<=0<=n) contains a string usernames[i] representing a username request in the order received.

Sample case 0

  • 4
  • home 
  • download
  • first
  • first

Sample Output 0

  • home
  • download
  • first
  • first1

Explanation 0

  •    foldername[0] = ‘home’ is unique
  •    foldername[1]=’download’ is unique
  •    foldername[2]= ‘first’ is unique
  •    foldername[3]=’first’ is already existing . so add 1 to it and it become first1

Question 4 : Airport Authority

Problem Statement -:

In an airport, the Airport authority decides to charge a minimum amount to the passengers who are carrying luggage with them. They set a threshold weight value, say, T, if the luggage exceeds the weight threshold you should pay double the base amount. If it is less than or equal to threshold then you have to pay $1.  

Function Description:

Complete the weightMachine function in the editor below. It has the following parameter(s):

Parameters:

NameTypeDescription
NIntegernumber of luggage
TIntegerweight of each luggage
weights[ ]Integer arraythreshold weight

Returns: The function must return an INTEGER denoting the required amount to be paid.

Constraints:

  • 1 <= N <= 10^5
  • 1 <= weights[i] <= 10^5
  • 1 <= T <= 10^5

Input Format for Custom Testing:

  • The first line contains an integer, N, denoting the number of luggage. 
  • Each line i of the N subsequent lines (where 0 <= i <n) contains an integer describing the weight of ith luggage. 
  • The next line contains an integer, T, denoting the threshold weight of the boundary wall.

Sample Cases:

  • Sample Input 1
    4
    1
    2
    3
    4
    3
  • Sample Output 1
    5
  • Explanation:
    Here all weights are less than threshold weight except the luggage with weight 4 (at index 3) so all pays base fare and it pays double fare.

Question 5: Candies

Problem Description

Question:- Krishna loves candies a lot, so whenever he gets them, he stores them so that he can eat them later whenever he wants to.

He has recently received N boxes of candies each containing Ci candies where Ci represents the total number of candies in the ith box. Krishna wants to store them in a single box. The only constraint is that he can choose any two boxes and store their joint contents in an empty box only. Assume that there are an infinite number of empty boxes available.

At a time he can pick up any two boxes for transferring and if both the boxes contain X and Y number of candies respectively, then it takes him exactly X+Y seconds of time. As he is too eager to collect all of them he has approached you to tell him the minimum time in which all the candies can be collected.

Input Format:

  • The first line of input is the number of test case T
  • Each test case is comprised of two inputs
  • The first input of a test case is the number of boxes N
  • The second input is N integers delimited by whitespace denoting the number of candies in each box

Output Format: Print minimum time required, in seconds, for each of the test cases. Print each output on a new line.

Constraints:

  • 1 < T < 10
  • 1 < N< 10000
  • 1 < [Candies in each box] < 100009
S. No.InputOutput
11
4
1 2 3 4
19
21
5
1 2 3 4 5
34

Explanation for sample input-output 1:

4 boxes, each containing 1, 2, 3 and 4 candies respectively.Adding 1 + 2 in a new box takes 3 seconds.Adding 3 + 3 in a new box takes 6 seconds.Adding 4 + 6 in a new box takes 10 seconds.Hence total time taken is 19 seconds. There could be other combinations also, but overall time does not go below 19 seconds.

Explanation for sample input-output 2:

5 boxes, each containing 1, 2, 3, 4 and 5 candies respectively.Adding 1 + 2 in a new box takes 3 seconds.Adding 3 + 3 in a new box takes 6 seconds.Adding 4 + 6 in a new box takes 10 seconds.Adding 5 + 10 in a new box takes 15 seconds.Hence total time taken is 34 seconds. There could be other combinations also, but overall time does not go below 33 seconds.

Question 6: Remove all characters in a given string that are not lowercase or numerical

The task is to remove all characters in a given string that are not lowercase letters or numerical digits. The purpose is to clean the string and only keep the lowercase letters (a-z) and numerical digits (0-9), discarding any other characters such as whitespace, punctuation marks, or uppercase letters.

  • For example
    • Input: “Hello!123$”
    • Output: “ello123”
    • Explanation: The input string contains uppercase letters, an exclamation mark, and a dollar sign. After removing all characters that are not lowercase or numerical, only the lowercase letters “e”, “l”, “l”, “o”, and the numerical digits “1”, “2”, “3” remain.

Write the code to remove all characters in a given string that are not lowercase or numerical.

Input Format: First line contains two numbers N,M

Output Format: Print all the stepping numbers present in the range.

Constraints: 0 <= N < M <= 1,000,000,000

Question 7 : Elements of Matrix

Problem Statement 

You are required to input the size of the matrix then the elements of matrix, then you have to divide the main matrix in two sub matrices (even and odd) in such a way that element at 0 index will be considered as even and element at 1st index will be considered as odd and so on. then you have sort the even and odd matrices in ascending order then print the sum of second largest number from both the matrices

Example

  • enter the size of array : 5
  • enter element at 0 index : 3
  • enter element at 1 index : 4
  • enter element at 2 index : 1
  • enter element at 3 index : 7
  • enter element at 4 index : 9

Sorted even array : 1 3 9
Sorted odd array : 4 7

7

Question 8: Queries for Count

The task is to determine the number of elements within a specified range in an unsorted array. Given an array of size n, the goal is to count the elements that fall between two given values, i and j, inclusively.
Examples:

Input:
Array: [1, 3, 3, 9, 10, 4]
Range 1: i = 1, j = 4
Range 2: i = 9, j = 12

Output:
For Range 1: 4
For Range 2: 2

Explanation:
In the first query, the numbers within the range 1 to 4 are 1, 3, 3, and 4.
In the second query, the numbers within the range 9 to 12 are 9 and 10.

Question 9: Fountains Installation

Fountains are installed at every position along a one-dimensional garden of length n. Array locations[] represents the coverage limit of these fountains. The ith fountain (where 1sisn) has a coverage limit of locations[i] that can range from the position max((i – locations[i]), 1) to min((i + locations[i]), n ). In other words, the h fountains do not reach outside the boundaries of the garden. In the beginning,all the fountains are switched off. Determine the minimum number of fountains that need to be activated to cover the n length garden by water.

Example

  • n = 3
  • locations[] = {0, 2, 13, then
    • For position 1: locations[1] = 0, max((1 – 0),
      • 1) to mini (1+0), 3) gives range = 1 to 1
    • For position 2: locations[2] = 2, max((2-2),
      • 1) to min( (2+2), 3) gives range = 1 to 3
    • For position 3: locations[3] = 1, max( (3-1),
      • 1) to min( (3+1), 3) gives range = 2 to 3

For the entire length of this garden to be covered, only the fountain at position 2 needs to be activated.

Function Description

Complete the function fountainActivation in the editor below.

fountainActivation has the following Parameter:

  • int locations[n]: the fountain locations

Returns

  • int: the minimum number of fountains that must be activated

Constraints

  • 1<_n<_ 10^5
  •  O<_locations[i] <_ mini (n,100) (where 1 <_1<_10^5)

► Input Format For Custom Testing

Sample Case 0

Sample Input For Custom Testing

  • 3 ->locations[] size n = 3
  • 1 ->locations[] [1, 1, 1
  • 1 ->Sample Output

Sample Output

  • 1

Explanation

Here, locations = {1, 1, 13

  • For position 1: locations[1] = 1, maxi (1 -1), 1) to min((1+1), 3) gives range = 1 to 2
  • For position 2: locations[2] = 1, max( (2 -1), 1) to min( (2+1), 3) gives range = 1 to 3
  • For position 3: locations[3] = 1, max((3 -1), 1) to min((3+1), 3) gyes range = 2 to 3

If the 2nd fountain is active, the range from position 7 to 3 will be covered. The total number of fountains needed is 1.

Question 10 : Death Note

Problem Statement  :

Ryuk, the Shinigami (God of death) had allowed Light Yagami, a school student, to kill as many people as he can by using a death note. But writing the names barely will allow other people to watch them. So he encrypts the names using digits, where a means 1, b means 2 and so on upto z is 26. Now if he gives numbers, there is a communication error because a number string can be decrypted by the death note in various ways and eventually killing them all. If everyone in the world has a unique name, for a given number, how many people can die?
NOTE THAT: There is every possible name in the world with the 26 letters, and capital or small letters is not a problem.

Input format:
A number stream denoting the first name’s encrypted version

Output Format:
Number of people dying by this.

Constraints:
1<=stream length<=10^8

Sample Input: 1267
Sample Output: 3
Output Specification:Two people of the name azg and lfg die.

FAQ's related ConvenGenius Hiring Process

Question 1: What kind of company is ConveGenius ?

ConveGenius is an EdTech Company that provides Affordable Educational Solutions for children of Rural areas of our country. They have Personalized and Adaptive Learning Platform that enables a specific, contextual approach that focuses on what learners need and guides teachers to teach better.

Question 2: What is the eligibility criteria for Convegenius hiring process?

Convegenius has following eligibility criteria for SDE intern role such as: 

    1. Minimum 6 C.G.P.A or Equivalent % throughout academic.
    2. B.TechCSE or IT.
    3. No current backlog allowed.
Question 3: What is the Selection process of Convegenius?

Convegenius selection process includes following steps:

  1. Online Assessment
  2. HR Interview
  3. 2 Rounds of Technical Interviews
Question 4: What are the skills required for Convegenius Hiring process ?

For Convegenius SDE role you must have good command in following skills:

  1. Data Structures and Algorithms
  2. Java
  3. JavaScript
  4. ReactJS / Node JS
  5. SQL 
  6. DBMS
  7. Operating Systems
Question 5: What is the salary in Convegenius?

For SDE Role:

  1. During Internship : ₹ 3 LPA 
  2. Post Internship Completion: For Full Time Role = ₹ 15 LPA

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription