# R1RCM Coding Questions

## R1RCM Coding Questions with Solutions

In this page, you will find out R1RCM Coding Questions and Answers asked in Online Assessments and Technical Interviews involved in the Hiring Process of the Company.

Go through this page to get more details like Job Profile, Job Location, CTC Offered, Steps involved in the recruitment process, etc of the company. R1RCM is a leading provider of technology-driven solutions that transform the patient experience and financial performance of healthcare providers. The company deliver proven ROI across the entire revenue cycle – front, middle and back office. This enables its customers to achieve an optimal revenue cycle – one that promotes patient satisfaction and improves financial performance.

The R1RCM Recruitment Process consists of the following steps :

1. Online  Assessment [ MCQ + Coding ]
2. Technical Interview
3. HR Interview

We have mentioned further details of the R1RCM Recruitment Process in the following Tabular Form

R1RCMRelated Information
Position :Trainee Software Engineer
Course :
• B.Tech – CSE, IT , ECE
• Eligible Batch – 2023
Eligibility Criteria / Academic Qualification Required :
• 60% (10th , 12th and graduation)
• No Current Backlogs.
CTC  :
• 7 LPA
Selection Process :
1. Online Assessment (MCQ + Coding)
2. Technical Interview
3. HR Interview
Joining Location :

Noida

### Related Banners

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

## R1RCM Coding Questions and Answers

### Question 1: Consecutive Prime Sum

Problem Description

Question – :  Some prime numbers can be expressed as a sum of other consecutive prime numbers.

• For example
• 5 = 2 + 3,
• 17 = 2 + 3 + 5 + 7,
• 41 = 2 + 3 + 5 + 7 + 11 + 13.
Your task is to find out how many prime numbers which satisfy this property are present in the range 3 to N subject to a constraint that summation should always start with number 2.

Write code to find out the number of prime numbers that satisfy the above-mentioned property in a given range.

Input Format: First line contains a number N

Output Format: Print the total number of all such prime numbers which are less than or equal to N.

Constraints: 2<N<=12,000,000,000

Run
```#include <stdio.h>

int prime(int b);
int main()
{
int i,j,n,cnt,a,c,sum=0,count=0,k=0;
printf("Enter a number : ");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
cnt=1;
for(j=2;j<=n/2;j++)
{
if(i%j==0)
cnt=0;
}
if(cnt==1)
{
a[k]=i;
k++;
}
}
for(i=0;i<k;i++)
{
sum=sum+a[i];
c= prime(sum);
if(c==1)
count++;
}
printf(" %d",count);
return 0;
}

int prime(int b)
{
int j,cnt;
cnt=1;
for(j=2;j<=b/2;j++)
{
if(b%j==0)
cnt=0;
}
if(cnt==0)
return 1;
else
return 0;
}```
```Output
Enter a number : 43
4```
Run
```#include <iostream>
using namespace std;

int prime(int b)
{
int j,cnt;
cnt=1;
for(j=2;j<=b/2;j++)
{
if(b%j==0)
cnt=0;
}
if(cnt==0)
return 1;
else
return 0;
}
int main()
{
int i,j,n,cnt,a,c,sum=0,count=0,k=0;
cout<<"Enter a number : ";
cin>>n;
for(i=2;i<=n;i++)
{
cnt=1;
for(j=2;j<=n/2;j++)
{
if(i%j==0)
cnt=0;
}
if(cnt==1)
{
a[k]=i;
k++;
}
}
for(i=0;i<k;i++)
{
sum=sum+a[i];
c= prime(sum);
if(c==1)
count++;
}
cout<<count;
return 0;
}```
```Output
Enter a number : 5
1```
Run
```import java.util.Scanner;
class Main {

static int prime(int b) {
int j,cnt;
cnt=1;
for (j = 2; j <= b/2; j++) {
if(b%j==0)
cnt=0;
}
if(cnt==0)
return 1;
else
return 0;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int i,j,n=0,cnt,c=0,sum=0,count=0,k=0;
Main t = new Main();
int[] a = new int;
System.out.println("Enter no");
n = sc.nextInt();
for (i = 2; i <=n ; i++) {
cnt=1;
for (j = 2; j <= n/2; j++) {
if(i%j==0)
cnt=0;
}
if(cnt==1) {
a[k]=i;
k++;
}

}
for (i = 0; i < k; i++) {
sum=sum+a[i];
c=t.prime(sum);
if(c==1)
count++;
}
System.out.println(count);
}

}```
```Output
43
4```
Run
```num = int(input())
arr = []
sum = 0
count = 0
if num > 1:
for i in range(2, num + 2):
for j in range(2, i):
if i % j == 0:
break
else:
arr.append(i)
def is_prime(sum):
for i in range(2, (sum // 2) +2):
if sum % i == 0:
return False
else:
return True
for i in range(0, len(arr)):
sum = sum + arr[i]
if sum <= num:
if is_prime(sum):
count = count + 1

print(count)```
```Output
20
2```

### Question 2 : Celsius to Fahrenheit

Problem Statement  :

There are two major scales for measuring temperature, celsius & Fahrenheit.Given a floating point input for temperature in celsius scale, Write a program to convert celsius to fahrenheit, up till 2 decimal points.

Input     Output
56           132.8

Explanation:
56 degrees celsius means132.8 degrees of Fahrenheit to be exact.

Run
```#include <iostream>

using namespace std;

int main() {
float temperature;
cin >> temperature;
cout << (temperature * 9) / 5 + 32;
return 0;
}```
Run
```import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
float n = sc.nextFloat();
float ans = ((n * 9.0 f / 5.0 f) + 32.0 f);
System.out.println(ans);
}
}```
Run
```def ctof(c):
return (c * 9) / 5 + 32
temperature = float(input())
ans = ctof(temperature)
print(round(ans, 2))
```

Question 3:

You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.

Input

• The single line of the input contains a pair of integers m, s (1 ≤ m ≤ 100, 0 ≤ s ≤ 900) — the length and the sum of the digits of the required numbers.

Output

• In the output print the pair of the required non-negative integer numbers — first the minimum possible number, then — the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers “-1 -1” (without the quotes).

Examples

• Input 1
2 15
• Output 1
69 96
• Input 2
3 0
• Output 2
-1 -1
Run
```#include<bits/stdc++.h>
using namespace std;

void number (int m, int s)
{

int sum = s;

string mini = "", maxi = "";

if ((m != -1 and s == 0) or s > 9 * m)
{
cout << "-1 -1";
return;
}

for (int i = 0; i < m; i++)
{
int x = min (9, s);
maxi += to_string (x);

s = s - x;
}

for (int i = 0; i < m - 1; i++)
{
int x = min (9, sum);
mini += to_string (x);

sum -= x;
}

mini = to_string (sum) + mini;

cout << mini << " " << maxi; return; } int main () { int m, s; cin >> m >> s;

number (m, s);

return 0;
}
```
Run
```import java.util.*;
class Solution
{
public static void solve(int m,int s)
{
int sum=s-1;
if(m!=-1&&s==0 || s>9*m)
{
System.out.println("-1 -1");
return;
}
String res1="",res2="";
for(int i=0;i< m;i++)
{
res1+=Math.min(s,9);
s=s-Math.min(9,s);
}

for(int i=0;i< m-1;i++)
{
res2+=Math.min(sum,9)+res2;
sum=sum-Math.min(9,sum);
}
res2=(sum+1)+res2;
System.out.println(res2+ " "+res1);
}
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int m=sc.nextInt();
int s=sc.nextInt();
solve(m,s);
}
}
```
Run
```n,s=map(int,input().split())
if(n>1 and s==0):
print(-1 , -1)

elif(n==1 and s==0):
print(0, 0)

else:
br=*n
i=0
brk=0
while(s>0):
if(i<n):
br[i]=min(9,s)
s=s-br[i]
i=i+1
else:
print(-1, -1)
brk=1
break

if(brk==0):
maxm=0
i=10
j=0
while(j<n): maxm=maxm*i + br[j] j+=1 #print(maxm) minm=0 j=n-1 i=10 f=0 while(j>=0):
if(j==n-1 and br[j]==0):
minm=minm+1

f=1
else:
if(br[j]>0 and f==1):
minm=minm*i + br[j]-1
f=0

else:
minm=minm*i + br[j]
#print('h')

j=j-1

print(minm,maxm)
```

### Question 4 : Help Anirudh

Problem Statement  :
Anirudh loves to play games but his father is very strict. But one day his father agreed to get him a new game if he solves the following problem –
Given an array of Integers, determine the number of moves to make all elements equal. Each move consists of choosing all but 1 element and Incrementing their values by 1. Can you help Anirudh?

Example :
numbers= [3, 4, 6, 6, 3]
Choose 4 of the 5 elements during each move and Increment each of their values by one. Indexing begins at 1. It takes 7 moves as follows:

iterationarray
0[3,4,6,6,3]
1[4,5,7,6,4]
2[5,6,7,7,5]
3[6,7,8,7,6]
4[7,8,8,8,7]
5[8,9,9,8,8]
6[9,9,10,9,9]
7[10,10,10,10,10]

Returns: long: the minimum number of moves required

Constraints
1<=n<=10^5
1<=numbers(i)<=10^6

Sample case 0:
Sample input 0:
5 → size of numbers[]
3 → numbers[]=[3,4,6,6,3]
4
6
6
3
Sample output 0:
7

Sample input 1:
4
4
3
4

Sample Output 1:
2

Run
```#include <bits/stdc++.h>

using namespace std;

int main() {
int t;
t = 1;
while (t--) {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) cin >> arr[i];
int min_element = INT_MAX;
long long int sum = 0;
for (int i = 0; i < n; i++) {
min_element = min(min_element, arr[i]);
sum += arr[i];
}
cout << sum - n * min_element << endl;

}
return 0;
}```
Run
```import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int arr[] = new int[n];

for (int i = 0; i < n; i++)
arr[i] = sc.nextInt();

int min = Integer.MAX_VALUE;
long sum = 0;
for (int i = 0; i < n; i++) {
min = Math.min(min, arr[i]);
sum = sum + arr[i];
}
System.out.println(sum - n * min);
}
}
```
Run
```def minMoves(n, nums):
s = 0
i = nums.index(min(nums))
for j in range(n):
if i == j:
continue
else:
s = s + nums[j] - nums[i]
return s

n = int(input())
numbers = []
for i in range(n):
numbers.append(int(input()))
print(minMoves(n, numbers))

```

### Question 5 : 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.

Run
```#include <bits/stdc++.h>

using namespace std;
int solve(vector < int > v) {
int n = v.size();
if (n == 0)
return 0;
int mx = v;
for (int i = 1; i < n; i++)
mx = max(mx, v[i]);
if (mx <= 0)
return 0;
int mxSum = 0;
int cSum = 0;
for (int i = 0; i < n; i++) {
cSum += v[i];
if (cSum < 0) cSum = 0; mxSum = max(mxSum, cSum); } return mxSum; } int main() { int n; cin >> n;
int price[n];
for (int i = 0; i < n; i++) cin >> price[i];
vector < int > diff;
for (int i = n - 2; i >= 0; i--) diff.push_back(price[i + 1] - price[i]);
int ans = solve(diff);
if (ans < 0) cout << 0 << endl;
else cout << ans << endl;
}
```
Run
```import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int price[] = new int[n];
for (int i = 0; i < n; i++) {
price[i] = sc.nextInt();
}
Vector < Integer > diff = new Vector < > ();
for (int i = n - 2; i >= 0; i--) {
}
int ans = solve(diff);
if (ans < 0) {
System.out.println(0);
} else {
System.out.println(ans);
}

}
private static int solve(Vector < Integer > v) {
int n = v.size();
if (n == 0) {
return 0;
}
int mx = v.get(0);
for (int i = 1; i < n; i++) {
mx = Math.max(mx, v.get(i));
}
if (mx <= 0) {
return 0;
}
int mxSum = 0, csum = 0;
for (int i = 0; i < n; i++) {
csum += v.get(i);
if (csum < 0)
csum = 0;
mxSum = Math.max(csum, mxSum);
}
return mxSum;
}
}
```
Run
```def func(diff):
n=len(diff)
if n==0:
return 0
mx=max(diff)
if mx <= 0:
return 0
mxS=0
cS=0
for i in diff:
cS+=i
if cS <= 0:
cS=0
mxS=max(cS,mxS)
return mxS
n=int(input())
arr=[]
diff=[]
ans=
for i in range(n):
arr.append(int(input()))
for i in range(n-1):
diff.append(arr[i+1]-arr[i])
ans=func(diff)
if ans < 0:
print("0")
else:
print(ans)```

## FAQs related to R1RCM Coding Questions

##### Question 1: What should I expect during the interview process?

During the interview process at R1RCM , you can expect to be asked a series of questions related to your experience, skills, and qualifications which are needed for Game Development. You will be showcasing your Game Development related skills like:

• Programming languages, including C++, Java, and C
• Experience in building libraries and APIs.
• Knowledge of the .net.
##### Question 2: Is Coding questions asked in R1RCM Recruitment Process?

Yes, Coding Questions are included in Online Assessment and Technical Interview of R1Rcm.

## 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