Devrev Coding Test Questions And Answers
Devrev Coding Test Questions
Devrev Test Coding Questions, which involves a computer-based online recruitment test, includes questions and answers on Devrev coding.
Before you begin the procedure, we would like to provide you with some information on how to attempt the test. The information on this page only relates to the campus employment process, so please be aware of that. When it comes to on-campus or off-campus activities, it may differ from region to region.
About Devrev Company
DevRev is the world’s first DevCRM. They empower organizations to engage with customers and convert product feedback into delightful experiences. DevRev recently announced one of the largest-ever seed funding rounds in the history of Silicon Valley. DevRev has a global presence with 5 offices across 3 countries and is expanding rapidly.
Devrev Company Eligibility Criteria
The role of Software Engineer (Frontend/Backend) is filled by Devrev. The eligibility requirements for the profile has been given below in tabular format.
Intuit Company | Software Developer |
---|---|
Batch | 2023 |
Course | All Branch / MCA |
Role | Software Engineer (Frontend/Backend) |
Education |
|
Stipend |
|
CTC | 12 LPA |
Internship Duration | 6 months |
Devrev Company Selection Criteria
- Round 1 – Online Coding Assessment
- Round 2 – Online Technical & Problem-Solving Interview
- Round 3 – Coding task followed by a detailed task review with our panel
- Round 4 – Technical interview
- Round 5 – Tech + Managerial/Leadership Round
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Sample Devrev Coding Test Questions With Solutions
Question 1 : Vowel Encryption
Problem Statement :
There is an encryption game going on. You will be given a number. If a digit is prime, it will take a vowel. Otherwise it will take a consonant value.
By this process, you have to make the string the lexicographically smallest possible. For a given number, print the output as a string.;
Input Format:
An integer n denoting the number.
Output Format:
The encrypted word.
Sample Input: 123421
Sample Output: baecab
#include<bits/stdc++.h> using namespace std; map < char, char > M; map < int, bool > prime; int main() { prime[2] = true; prime[3] = true; prime[5] = true; prime[7] = true; char vow[] = { 'a', 'e', 'i', 'o', 'u' }; char con[] = { 'b', 'c', 'd', 'f', 'g', 'h' }; int jv = 0, jc = 0; string s; cin >> s; for (auto i: s) { if (prime[i - '0']) { if (M[i]) {} else { M[i] = vow[jv]; jv++; } } else if (M[i]) {} else { M[i] = con[jc]; jc++; } } for (auto i: s) cout << M[i]; }
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String vowel = "aeiou"; char arr[] = new char[10]; arr[2] = 'a'; arr[3] = 'e'; arr[5] = 'i'; arr[7] = 'o'; char ch = 'b'; for (int i = 1; i < arr.length; i++) { if (vowel.indexOf(ch) != -1) { ch++; continue; } else if (arr[i] == 0) arr[i] = (char) ch++; } int temp = n; int res = 0; while (temp != 0) { res = res * 10 + temp % 10; temp = temp / 10; } int i = 1; while (res != 0) { System.out.print(arr[res % 10]); res = res / 10; } } }
s = input() res = [] x, y = 0, 0 v = "aeiou" c = "bcdfgh" p = "2357" ans = sorted(set(s)) for i in ans: if i in p: res.append(v[x]) x += 1 else: res.append(c[y]) y += 1 for i in s: print(res[ans.index(i)], end="")
Question 2 : Last student’s ID (R->Medium+)
Problem Statement :
There is an id code that is supposed to be given to all the aspirants of an exam. It is actually a substring of a given string. That means, the authority takes a string and then assigns all the unique substrings to all the students. Suppose there is a string “abcde”, so the ids of the students will be “a”,”b”,”c”,”d”,”e”,’ab”,”abc”,”abcd”,”abcde”,”bc”,”bcd”,”bcde”,”cd”,”cde”,”de”.
The students are standing in a line according to the lexicographic order of their given ids. You have to find out the id of the last student for the given input string from which the ids are generated.
Input Format:
Single line with the id generating string
Output format:
The last id as per lexicographical order
Constraints:
Number of characters in the string<=10^9
Sample Input:
abdc
Sample output:
dc
Explanation:
The last student will be with the id dc. The order will be
abdc
a
ab
abd
abdc
b
bd
bdc
c
d
dc
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector < string > v; for (int i = 0; i < s.length(); i++) { v.push_back(s.substr(i, s.length() - i)); //cout<<v[i]<<endl; } sort(v.begin(), v.end(), greater < string > ()); cout << v[0]; }
import java.util.*; public class Main { public static String maxString(char set[]) { int n = set.length; String temp = ""; TreeSet < String > list = new TreeSet < > (); for (int i = 0; i < n; i++) { temp = ""; for (int j = i; j < n; j++) { temp = temp + set[j]; list.add(temp); } } return list.last(); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); char arr[] = str.toCharArray(); System.out.println(maxString(arr)); } }
s = input() j = 1 c = 0 while j < len(s): if ord(s[c]) < ord(s[j]): c = j j += 1 print(s[c:])
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
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; vector v(n); for(int i=0;i<n;i++) cin>>v[i]; map<string,int> m; for(auto i:v){ if(m[i]) cout<<i<<m[i]<<endl; else cout<<i<<endl; m[i]++; } }
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); LinkedHashMap<String, Integer> map=new LinkedHashMap<>(); for(int i=0;i<n;i++){ String str=sc.next(); if(map.containsKey(str)){ int count=map.get(str); count = count+1; map.put(str,count); } else map.put(str,1); } Set s = map.entrySet(); Iterator itr = s.iterator(); while(itr.hasNext()){ Map.Entry m=(Map.Entry)itr.next(); int value=(Integer)m.getValue(); System.out.println(m.getKey()); value--; for(int i=1;i<=value;i++){ System.out.println(m.getKey()+""+i); value--; } } } }
n=int(input()) arr = [] ans = "" for i in range(n): arr.append(input()) print() for i in range(n): if arr[:i+1].count(arr[i])>1: ans = arr[i]+str(arr[:i+1].count(arr[i])-1) else: ans = arr[i] print(ans)
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:
iteration | array |
---|---|
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
#include <bits/stdc++.h> using namespace std; int main() { // your code goes here 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; }
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); } }
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 : Stars Between Bars
Problem statement :
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 :
int [n];each element[i] answers the query of startIndex[i] to endindex[i]
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 Case 0
Sample Input for Custom Testing
*|*| → 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.
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n; cin >> n; int st[n], ed[n]; for (int i = 0; i < n; i++) { cin >> st[i]; st[i]--; } cin >> n; for (int i = 0; i < n; i++) { cin >> ed[i]; ed[i]--; } vector < int > bars; for (int i = 0; i < s.length(); i++) { if (s[i] == '|') bars.push_back(i); } for (int i = 0; i < n; i++) { int idx = lower_bound(bars.begin(), bars.end(), st[i]) - bars.begin(); st[i] = bars[idx]; idx = lower_bound(bars.begin(), bars.end(), ed[i]) - bars.begin(); if (idx == 0 || bars[idx] == ed[i]) continue; ed[i] = bars[idx - 1]; } int sz = s.length(); int starCt[sz] = { 0 }; if (s[0] == '*') starCt[0] = 1; for (int i = 1; i < sz; i++) { starCt[i] = starCt[i - 1] + (s[i] == '*'); } for (int i = 0; i < n; i++) { if (st[i] >= ed[i]) { cout << 0 << endl; } else { int ans = starCt[ed[i]]; if (st[i] > 0) ans -= starCt[st[i] - 1]; cout << ans << endl; } } return 0; }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); int n = sc.nextInt(); int startIndex[] = new int[n]; int endIndex[] = new int[n]; for (int i = 0; i < n; i++) startIndex[i] = sc.nextInt(); for (int i = 0; i < n; i++) endIndex[i] = sc.nextInt(); int count = 0; for (int i = 0; i < n; i++) { count = 0; String sub = str.substring(startIndex[i] - 1, endIndex[i]); int start = sub.indexOf("|"); int end = sub.lastIndexOf("|"); for (int j = start; j < end; j++) if (sub.charAt(j) == '*') count++; System.out.print(count + " "); }
s = input() start = [] end = [] n = int(input()) for i in range(n): start.append(int(input())) for i in range(int(input())): end.append(int(input())) for i in range(n): Str = s[start[i] - 1 : end[i]] print(Str.strip("*").count("*"))
FAQs on Devrev Coding Test
Question 1: Does the Devrev recruitment process includes coding test?
Yes, Devrev always asks Coding Questions in Online as well as Technical Assessments and also in Technical Interviews for Recruiting Software Engineers.
Question 2: What does Devrev really do?
DevRev is a business software company that connects developers (dev) and customers (rev) in the product-led growth age. The business is developing an API-first dev-centric CRM that will leverage data, design, and machine intelligence to enable developers to establish, support, and grow their revenue.
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
Login/Signup to comment