Persistent Coding Test Questions 2023

Persistant Coding Test Questions 

Here you will get all the detailed information related to Persistent Coding Test Questions 2023. Below you will get questions for practice so that you can score good marks in Persistent Coding Test Questions.

The difficulty level of the Persistent Coding Test Questions is high.

link

Here you will get all the detailed information related to Persistent Coding Test Questions 2023. Below you will get questions for practice so that you can score good marks in Persistent Coding Test Questions.

The difficulty level of the Persistent Coding Test Questions is high.

Name of the Section Coding Assessment
Number of Questions 2
Total Time Limit 40 min
Difficulty Level High

Prime Course Trailer

Related Banners

Persistent Coding Test Questions Curriculum 2023

In Persistent Coding there will be 2 Coding Questions that you have to solve in C Language.You can write code in only one language.

  • C language

The difficulty level of the questions will be high. You have to solve at least 1 and half question to get select for the next round. So you have to practice a lot so that you can solve questions of Persistent coding test.

Detailed analysis of Persistent Coding Test Questions and Answers:

  • Number of Questions:- 2
  • Time Limit:- 40 min
  • Difficulty Level- High

Persistent Coding Questions in 2023 With Solutions:-

Persistent Coding Test Question 1

Sajith loves numbers and coding. His dad gives a task to write a code to find the nth largest number in an array.

Input 

  • The inputs have : First the count of integers and the second n value
  • The second line of the input has the list of integers that he needs to do the operations upon.

Output

  • You have to print the integer representing the nth largest out of the numbers given by his father

 

Constraints

  • 0 < value n <=  count of integers <= 10^6
  • -10^6 <= each integer <= 10^6
  • 0 <= i < count of integers

 

Example

Input

5  3
11 -1 – 4 12 -6

Output 

-1

Explanation :

-1 is 3rd largest

 

Persistent Coding Test Question 2

Flipkart has been infected with a virus, the virus works this way: Each user that has been infected with the virus is traced by a special algorithm and a hint that the virus gives. The virus leaves a hint number N.

Flipkart is able to identify the user ID of the virus by this N number as the user ID works as a series : Each number in the series is the sum of the last three numbers in the series. The first three numbers in the series are 0, 0, 1 always.

Write a program to identify the user ID infect based on N value checked from the logs of the system

Input

  • The input contains the N value left by the virus and found by engineers in the logs of the system

Output

  • Print the userID of the infect user.

Example

Input

11

Output 

81

Example

Input

16

Output 

1705

Persistent Coding Question 3

Given an unsorted array of n elements, find if the element k is present in the array or not. Complete the findNumber function in the editor below.

It has 2 parameters:

  1. An array of integers,arr,denoting the elements in the array.
  2. An integer,k,denoting the element to be searched in the array.

The function must return a string “YES” or “NO” denoting if the element is present in the array or not.

Input Format

  • The first line contains an integers n,denoting the number of elements in the array arr.
  • Each line i of the n subsequent lines (where 0<=i<=n) contains an integer describing arri.
  • The next line contains an integer,k,the elements that needs to be searched.

Constraints

  • 1 <= n <= 105
  • 1 <= arr[i]<= 109

Output Format

The function must return a string “YES” or “NO” denoting if the element is present in the array or not.This is printed to stdout by locked stub code in the editor.

Sample Input 0

5
1
2
3
4
5
1

Sample Output 0

YES

Explanation 0

Given the array =[1,2,3,4,5],we want to find the element 1 if it is present or not. We can find the element 1 at index = 0.Therefore we print “YES”.

Sample Input 1

3
2
3
1
5

Sample Output 1

NO

Explanation 1

Given the array[2,3,1] and k = 5. There is no element 5 in the array and therefore we print “NO”.

Persistent Coding Question 4

Sum is given a rectangular paper having dimension h x w, where h is the height and w is the width. Sam wants to fold the paper so its dimension are h1 x w1 in the minimum number of moves. The paper can only be folded parallel to its edges, and after folding the dimension should be integers.

For example, given h =8 and w =4, fold the paper until it is h1,w1 =6,1. Find fold along the long edge 6 units from a side, resulting in a paper that is 6 x 4. Next, fold along the width 2 units from the 4 unit edge to have 6 x 2. Fold along the center of the 2 units edge to achieve a 6 x 111 page in three folds.

Function Description

Write a function minMoves, which will return an integer value that denotes the minimum number of moves in which the task can be achieved

minMoves has the following parameter:

  • h: an integer that denotes the initial height
  • w: an integer that denotes the initial width
  • h1: an integer that denotes the final height
  • w1: an integer that denotes the initial width

Sample Input 0

2
3
2
2

Sample Output 0

1

Explanation

The initial dimension of the paper is 2 x 3. This should be connected to 2 x 2. Fold along a line 1 unit in from the edge of the 7 unit side.

Sample Input 1

6
3
3
1

Sample Output 1

3

Explanation

Initial dimension of the paper are 6 x 3. This should be connected to 3 x 3. This can be done in the following way. There can be many other ways to solve, this is one of the ways.

6 x 3 -> 3 x 3 -> 3 x 2 -> 3 x

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

Frequently Asked Questions (FAQs)

 What is the difficulty level of this coding round?

The difficulty level of this section is higher than the rest of the sections

Which programming language is recommended for coding round?

 You can write code in only one language.

  • C language