WeCP Coding Questions

WeCP Practice Coding Questions for Freshers

WeCP is a technical skill assessment platform which helps the organization in recruiting students who are highly proficient in technical skills like hardware and software. One of the most important sections of WeCP exams is the coding round.

WeCP Coding Questions for practice

WeCP Practice Coding Questions for Freshers

WeCP is a technical skill assessment platform which helps the organization in recruiting students who are highly proficient in technical skills like hardware and software. One of the most important sections of WeCP exams is the coding round.

WeCP Coding Questions for practice

More About WeCP Companies based Coding Questions

WeCP Coding questions are not that tough but they are tricky, and because of the time constraints it makes it tough to solve them. Here, we have provided a few sample questions based on the pattern of questions that companies asks through WeCP. These questions will help you in preparing for the exams, make sure you go through all of them.

Pattern for WeCP Companies based Coding Questions

Coding RoundDetails
Number of Questions2-3
Time Limit2 hrs(approx)
Difficulty levelmoderate
Package Offered5 LPA – 7.5 LPA

Practice Questions for WeCP Coding Round

Question 1: Sentence counter

Problem statement-:  We know sentences are terminated with certain punctuations like ‘.’,’!’,’?’, whereas there are several punctuations which don’t terminate the punctuations. Given for a paragraph, write a code to find out how many sentences are there.

Note that, ‘…’,’,’,’-‘ these don’t terminate a sentence.

 

Constraints: 

  • Number of words in the paragraph<=10^8

 

Input Format:

  • Paragraph ended with an enter.

 

Output Format:

  • Single Integer denoting number of sentences.

 

Sample Input:

Hello! How are you? Last time I saw you… you were nervous.

Sample Output:

3

Explanation:

The three sentences are:

hello!

How are you?

Last time I saw you… you were nervous.

Question 2: Even Odd Even Odd 

Problem Statement -:  A number is even odd special if and only if there are even digits side by side, same goes for odd digits too. So the distributions must be in an alternating basis of even digits and odd digits. You are given a number N, and you have to say how many special numbers are possible <=N, and are greater than 0.

 

Constraints:

  • 1<=N<=10^8

 

Input Format:

  • First Line containing a single integer N.

Output Format:

  • Single line containing a single integer denoting the possible number of special numbers.



Sample Input:

30

 

Output:

20

 

Explanation:

20 such special numbers are there :-

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 21, 23, 25, 27, 29, 30

Question 3: Profit balance

Problem Statement-: Anand and Brijesh got a bunch of profit in their business. Now it’s time to divide the profit between themselves. Anand being the one with the calculator was the one who could decide who will get how much. But as he was one hell of an honest guy, he can’t cheat on Brijesh to get some extra money. So he decided to divide them in such a way where they can get almost the same amount possible. Although, it is sometimes impossible to divide the profit into two, because the profits must be written in their production managed copy in a way where you cannot share the profit of a single thing, A single Profit will be held by a single person.

You are the one who is called to mitigate the problem. Given an array of profit, find out in the process, what can be the minimum difference between them in terms of income.

 

Constraints:

  • 1<=N<=10^3
  • 0<=Profits<=1000

Input Format:

  • First line contains an integer N, number of profits.
  • Next line, N space separated Integers denoting the i-th Profit.

 

Output:

  • A single integer denoting minimum possible difference between the total profits.

 

Sample Input:

4

1 2 3 4

 

Output:

0

 

Explanation:

He will take 1 and 4, so his profit will be 5, so the difference will be 0.

Question 4: Class Monitor

Problem Statement-: After JEE Mains, some students got admission into an engineering college. Now there is a class consisting of such n students, and the HOD came to say it is time to select the class monitor. But He never gets all of them at one time. So he brought a register, every time he gets someone with less rank than the previous time he cut the name and wrote the name of the student and the rank.

For a given number of ranks he gets each time, you have to predict how many names are cut in the list.

 

Constraints:

  • Number of Visiting<=10^9
  • ranks <=10000

 

Input Format:

  • Number of Visiting N in their first line
  • N space separated ranks the HOD gets each time

 

Output Format:

  • Number of ranks cut in the list

 

Sample Input:

6

4 3 7 2 6 1

 

Sample Output:

3

Question 5: Corona for Computer

Problem Statement-: Every decimal number can be changed into its binary form. Suppose your computer has it’s own CoronaVirus, that eats binary digits from the right side of a number. Suppose a virus has 6 spikes, it will eat up 6 LSB binary digits in your numbers.

You will have a bunch of numbers, and your machine will have a virus with n spikes, you have to calculate what will be the final situation of the final numbers. 

 

Input Format:

  • First line, a single Integer N
  • Second line N space separated integers of the bunch of values as array V
  • Third line a single integer n, the number of spikes in Corona for Computer

 

Output Format:

  • Single N space separated integers denoting the final situation with the array v.

 

Sample Input:

5

1 2 3 4 5

2

 

Sample Output:

0 0 0 1 1

 

Explanation: 

5 is 101 in binary, when you cut the last two binary digits, its 1.

Question 6: 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:

011,110,101 -> These three numbers.

Question 7: Momentum LinkedList

Problem Statement -:  Ratul made a linked list, a list made of n nodes, where every node has two variables, the velocity and the mass of a particle.

Since all the particles have the velocity in the same direction, find the total momentum of the entity made by the particles from the linked list.

 

Constraints :

  • 1<=n<=10000
  • 1<=m,v<=100

 

Input format:

  • First line containing n, number of nodes
  • Then n lines containing the mass and the velocity space separated.

 

Output Format:

  • Single integer denoting the momentum

 

Sample Input:

4

1 3

2 4

2 3

4 5

Sample Output:

37

Question 8: Lazy String

 

Problem Statement-:  Anish is the laziest person you can ever see. He is tasked to write the name of the winner in a game where two people take part. And he just writes the longest common subsequence over there, so that with minimum chane or no backspace he can edit the name to the winner’s name.

For two given names, you have to predict what Anish will write in his computer before the start of the name. If there are more than two longest subsequences possible,write the one with less lexicographic value.

 

Input Format:

  • Two lines including two strings of name(All with capital letters)

Output Format:

  • A single line with the lexicographically smallest possible longest common subsequence.

 

Sample Input:

ABCD
BACD

Sample Output:

ACD

Explanation:

ACD and BCD these are the two possible biggest substring