Zycus Coding Questions and Answers

Zycus Coding Questions with Solutions

In this page, you will find out Zycus Coding Questions and Answers asked in Online Assessment and Technical Interview involved in the Hiring Process of the Company.

By the end of Zycus Coding Questions and Answers page you’ll get FAQ’s related to Zycus Recruitment Process like Job Profile, CTC Offered, Steps involved in the recruitment process, etc. of the company.

zycus-coding-questions-with-solutions

Zycus Coding Questions and Answers

Question 1: Stars Between Bars

Given a string s consisting of stars “*” and bars  “|” ,an array of starting indices  starIndex,and an array of ending indices endIndex,determine the number of stars between any two bars within the substrings between the two indices inclusive . NOTE that in this problem indexing starts at 1.

  • A Star is represented as an asterisk [*=ascii decimal 42]
  • A Bar is represented as a Pipe [“|”=ascii decimal 124]

Example

    s=’|**|*|’ 
    startIndex=[1,1]
    endIndex=[5,6]

  • For the first pair of indices (1,5) the substrings is “|**|*”  . There are 2 stars between a pair of bars
  • For the second pair of indices (1,6) the substring is  “|**|*|” and there are 2+1=3 stars in between the bars.
  • Both of the answers are returned to the array [2,3].

Constraints

  • 1<=n<=105
  • 1<=StartInde[i]<=endIndex[i]
  • Each Character of s is either “*” or “|”

Input Format for Custom testing

First line contains a string S the next line contains an integer n , the no.of elements in startIndex. Each line i of the n subsequent lines contains an integer of startIndex.the next line contains an integer n , the no.of elements in endIndex. Each line i of the n subsequent lines contains an integer of endindex  

Sample Input

    *|*|  → s=”*|*|”
    1 → startindex[] size=1
    1 → startindex= 1
    1 → endindex[] size=1
    3 → endindex=3

Sample output:

    0

Explanation :

The substring from index =1 to index=3 is “*|*” . there is no consecutive pair of bars in this string.

Prime Course Trailer

Related Banners

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

Question 2 : Coloured Zenga

Problem Statement :

Rahul is playing a game, wherein he has multiple coloured wooden blocks, stacked one above the other, his task is to remove all the wooden blocks from the stack, without letting it fall and in the minimum number of steps. He can remove one block of a colour at a time, but he can remove multiple blocks of the same colour together. Determine the minimum number of steps in which he can perform this task.

For example, if you remove [red,red] from (white,red,red,white), the resulting array is [white,white].

Note- there are only two colour blocks – red and white

Function description :

Complete the minMoves function in the provided editor. It contains the following parameters:

Parameters:

NameTypeDescription
NIntegerNo. of Wooden blocks
Array[ ]Integer ArrayArray of Blocks.

Input format :

The first line contains an integer n denoting the number of blocks. Each n line denotes the colour of the wooden block .

Constraints :
1<=n<=700
0<=a[i]<=1

Sample input 1 :

4
red
white
white
red

Sample Output 2 :

2

Explanation :

Remove [white,white] first The array will be [red,red] The remaining numbers can  be removed in one strap .

Sample Input 1:

4
white
red
white
red

Sample Output 1:

3

Sample Explanation:
0
The steps are [white,red,white,red]->[red,white,red]->[red,red]->[]. Therefore the answer is 3.

Question 3: Fantasy Premier League

Problem statement :

Ramesh loves to bet and also loves football, so he created a fantasy football team in FPL. He chose Rashford in his team. You are given a string in which each index denotes a match and it consists of characters: Y, G, A. G means goal scored and the player is awarded 4 points, for A 3 points, and for every Y, 1 point is deducted.

Calculate the points scored by rashford

Constraints:

  • 0<n<105

Sample case 0:

Sample input 0:

EHH → erica=”EHH”

EME → bob=”EME”

Sample output 0:

Erica

Explanation 0:

Erica’s score is , 1+5+5=11

Bob’s score is , 1+3+1=5

So Erica is the winner

Question 4 : Share Holder (R -> Hard)

Problem Statement  :
Ratan is a crazy rich person. And he is blessed with luck, so he always made the best profit possible with the shares he bought. That means he bought a share at a low price and sold it at a high price to maximize his profit. Now you are an income tax officer and you need to calculate the profit he made with the given values of stock prices each day. You have to calculate only the maximum profit Ratan earned.
Note that:
Ratan never goes into loss.

Example 1 :
Price=[1,6,2]
Ratan buys it on the first day and sells it on the second.
Example 2 :
Price=[9,8,6]

The Price always went down, Ratan never bought it.

Input Format:
First line with an integer n, denoting the number days with the value of the stack
Next n days, telling the price of the stock on that very day.

Output Format:
Maximum profit done by Ratan in a single line.
Constraints:
Number of days <=10^8

Sample Input for Custom Testing:

STDIN
7
1
9
2
11
1
9
2

Sample Output :

10

Explanation :

The maximum profit possible is when Ratan buys it in 1 rupees and sells it in 11.

Question 5 : 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 6 : Game Of Clicks [ R->Hard ]

Problem Statement  :

Sahil watches TV all day and gets bored. He started playing this dumb game of identifying minimum number of inputs needed to reach a channel. As his cousin, you have to help him, but you live far from his house. So you decide to write a code that will ask Sahil for some inputs and give outputs respectively.

Here are the problems you need to keep in mind :

  • There are 13 buttons on his remote: 10 buttons for the numbers (0-9) to form integers denoting respective channel index, “Up channel” button and “ Down channel” button for going i +1th channel and i-1th channel from i respectively, and a “Last viewed” button to see what’s the last channel before it.
  • The number buttons allow you to jump directly to a specific channel (Ex: to go to channel 172 by typing 1,7,2).
  • If the channel which you are in is ith and that is the max channel index possible, by Up channel, you will reach the first channel possible. Same goes for the down channel button. You can go to the highest channel possible if you go down from the lowest channel possible.
  • Sahil can get from one channel to the next in one of the two ways.
  • Sahil’s parents have set some parental control on some channels on Aniruth’s television. The “Up Channel “ and “Down buttons” buttons skip these channels as these channels are not viewable.
  • Given a list of channels to view, the lowest channel, the highest channel, and a list of blocked channels, your program should return the minimum number of clicks necessary to get through all the shows that Anirudh would like to match.

Input Format :

  • First line is the lowest Channel
  • Second-line is the highest Channel
  • Followed by a number of blocked channels B,
    and the next B lines contain the actual blocked channels.
  • Followed by the number of Channels to view V, and the next V lines contain the actual channels to view.

Constraints :

  • The lowest channel on the television will be greater than 0. and less than or equal to 10,000.
  • The highest channel on the television will be greater than or equal to the lowest channel. and less than or equal to 10.000.
  • The list of channels that are blocked on Anirudh’s television. All the channels in this list will be valid channels (greater than or equal to lowest channel, less than or equal 1 to highest channel). Duplicates may be Ignored. The blocked list can be a maximum of 40 channels.
  • The sequence that Sahil must view contains between 1 and 50 elements. inclusive. All channels in this sequence are not in the blocked list and are between lowest channel and highest channel. Inclusive.

Sample Input 0:
1
20
2
18
19
5
15
14
17
11
17
Sample output 0:
8

Question 7 : 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 8 : Help of Prepsters

Problem Statement :

Arnab has given me a challenge. I have to calculate the number of numbers which are less than a certain value n, and have exactly k set bits in its binary form. As you are a Prepster like me, help me write a code that will take input for n and k and give the expected output.

Constraints :
1<=n<=10000
1<=k<=10
Input Format :
First line containing n and k space separated
Output Format :
Number of numbers present in a single line

Sample Input:
7 2
Sample Output:
3
Explanation:
11,110,101 -> These three numbers.

Question 9 : Maneuvering a Cave Problem

Problem Description

The task is to count all the possible paths from top left to bottom right of a m x n matrix with the constraints that from each cell you can either move only to right or down.

Input: 

  • First line consists of T test cases. First line of every test case consists of N and M, denoting the number of rows and number of columns respectively.

Output: 

  • Single line output i.e count of all the possible paths from top left to bottom right of a m x n matrix..

Constraints:

  • 1<=T<=100
  • 1<=N<=100
  • 1<=M<=100

Question 10 : Stocks 

Problem Statement – Ratan is a crazy rich person. And he is blessed with luck, so he always made the best profit possible with the shares he bought. That means he bought a share at a low price and sold it at a high price to maximize his profit. Now you are an income tax officer and you need to calculate the profit he made with the given values of stock prices each day. You have to calculate only the maximum profit Ratan earned.

Note that:

  • Ratan never goes into loss.

Example 1

  • Price=[1,6,2]
  • Ratan buys it on the first day and sells it on the second. 

Example 2

  • Price=[9,8,6] 

The Price always went down, Ratan never bought it.

Input Format:

  • First line with an integer n, denoting the number days with the value of the stack
  • Next n days, telling the price of the stock on that very day.

Output Format:

  • Maximum profit done by Ratan in a single line.

Constraints:

  • Number of days <=10^8

Sample Input for Custom Testing

 STDIN              

———–       

7

11

2

Sample Output

  10

 Explanation

The maximum profit possible is when Ratan buys it in 1 rupees and sells it in 11.

FAQs on Zycus Games Coding Questions

Question 1: How do I prepare for a Zycus technical interview?

Applicants must have Good Command in Advanced DSA and Core Computer Science Engineering concepts to pass the Technical Interview of Zycus.

Question 2: In which field Zycus focus on?

The company focuses on digital purchasing, e – invoice processing, expense analysis, online supplier sourcing, contract handling, supplier relationship management, and financial savings tracking.

Question 3: What is the salary of PayPal Sde1?
Zycus’s salary for entry level SDE role in India ranges between ₹ 4 LPA to ₹ 5 LPA for less than 1 year of experience.
Question 4: What is Zycus Recruitment Process?

There are 3 Rounds conducted for PayPal Recruitment Process:

  1. Online Aptitude + Technical Assessment
  2. Coding Round + Technical Interview
  3. HR Interview

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