MPL Coding Questions and Answers
MPL Coding Questions with Solutions
On this page, you will get MPL Coding Questions and Answers, which were asked in Online Coding Test and Technical Interviews included in MPL Recruitment Process.
Apart from that you will get the details on MPL Recruitment process including CTC Offered, Eligibility Criteria, and Job Profile.
About MPL
MPL (Mobile Premier League) is a Bangalore-based e-sports and mobile gaming platform that offers a range of skill-based games for users to play and win real money. The platform offers games in a variety of genres, including sports, fantasy, strategy, action, and arcade, among others. Users can participate in daily and weekly tournaments to compete with other players and win cash prizes.
MPL also partners with game developers and content creators to offer exclusive games and experiences to its users. The company was founded in 2018 and has since grown to become one of the leading mobile gaming platforms in India with a user base of over 100 million players.
About MPL Recruitment Process
MPL Recruitment Process involves 3 steps for hiring the applicants:
- Online Aptitude Test
- Group Discussion
- Technical Interview
- HR Interview
We have given the details of Group Discussions, Technical Interviews, and HR Interviews separately in the following sections
- Group Discussions
Here, Recruiters ask about some opinions and views on the latest trends in Technical Fields, Social Issues, Current Affairs, etc. To test the mindset and perspective of the applicant. For more details check out the link given below:
- Technical Interview
Here Recruiters test the candidate’s technical skills, including topics like Programming Skills, Problem-Solving Skills, and other Domain Based Questions. Click on the button given below to get more details:
- HR Interview
Here, the HR tests Personality, Strengths, Weaknesses, etc. For checking whether the candidate is the best fit for Offered Role or not. Click on the button given below to get more details:
In the table below, we have provided further information on the MPL Recruitment Process.
MPL | Related Information |
---|---|
Position : | Data Analytics Intern |
Course : |
|
Eligibility Criteria / Academic Qualification Required : |
|
CTC Offered : |
|
Selection Process : |
|
Joining Location : | Bangalore |
Skills required for the Job profile of Data Analytics Intern:
- Good Programming Skills in Python or R.
- Knowledge in Computer Science subjects like Data Structures, Algorithms, Database, Computer Networks, Operating Systems etc.
- Familiar with PySpark, AWS, and Rest/Fast APIs.
- Good Analytical and Problem-Solving Skills.
- Details on this page mentioned, are on the basis of On-Campus Drives.
- Eligibility Criteria, Recruitment Pattern, Types of Questions in Online Assessment may vary according to different Job Profile.
- In this page we have discussed the details for Hiring of Data Analytics Intern only.
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
MPL Coding Questions with Solutions
Question 1 : Whole Number
Given a positive whole number n, find the smallest number which has the very same digits existing in the whole number n and is greater than n. In the event that no such certain number exists, return – 1.
Note that the returned number should fit in a 32-digit number, if there is a substantial answer however it doesn’t fit in a 32-bit number, return – 1.
Example 1:
Input: n = 12
Output: 21
Explanation: Using the same digit as the number of permutations, the next greatest number for 12 is 21.
Example 2:
Input: n = 21
Output: -1
Explanation: The returned integer does not fit in a 32-bit integer
#include <iostream> using namespace std; void swap(char *a, char *b) { char temp = *a; *a = *b; *b = temp; } void findNext(char number[], int n) { int i, j; for (i = n-1; i > 0; i--) if (number[i] > number[i-1]) break; if (i==0) { cout << "Next number is not possible"; return; } int x = number[i-1], smallest = i; for (j = i+1; j < n; j++) if (number[j] > x && number[j] < number[smallest]) smallest = j; swap(&number[smallest], &number[i-1]); sort(number + i, number + n); cout << number; return; } int main() { char digits[]; cin>>digits int n = strlen(digits); findNext(digits, n); return 0; }
import java.util.*; public class Main { static void swap (char ar[], int i, int j) { char temp = ar[i]; ar[i] = ar[j]; ar[j] = temp; } static void findNext (char ar[], int n) { int i; for (i = n - 1; i > 0; i--) { if (ar[i] > ar[i - 1]) { break; } } if (i == 0) { System.out.println ("Not possible"); } else { int x = ar[i - 1], min = i; for (int j = i + 1; j < n; j++) { if (ar[j] > x && ar[j] < ar[min]) { min = j; } } swap (ar, i - 1, min); Arrays.sort (ar, i, n); for (i = 0; i < n; i++) System.out.print (ar[i]); } } public static void main (String[]args) { Scanner sc = new Scanner (System.in); int n = sc.nextInt (); String s = sc.next (); char digits[] = s.toCharArray (); findNext (digits, n); }}
arr=[] def permute(s,ans): n=len(s) if (n==0): arr.append(ans) return for i in range(n): ch = s[i] L= s[0:i] R= s[i + 1:] REM= L+ R permute(REM,ans+ ch) ans= "" s = input() n=len(s) permute(s,ans) arr=list(set(arr)) arr.sort() ind=arr.index(s) if(ind==len(arr)-1): print(-1) else: print(arr[ind+1])
Question 2 : Islands
Problem Statement: Given boolean 2D matrix , find the number of islands. A group of connected 1s form an island. For example, the below matrix contains 5 islands.
Example :
m =5, n=5
1 1 0 0 0
0 1 0 0 1
1 0 0 1 1
0 0 0 0 0
1 0 1 0 1
Output :
5
Explanation: There are total 5 island in the matrix.
import java.util.*; class Solution { private int directions[][] = { { 1,0}, { -1, 0}, { 0, 1 }, { 0,-1 } }; public static int countIsland(int[][] arr) { if (arr == null || arr.length == 0) return 0; int islandId = 2, m = arr.length, n = arr[0].length; Map < Integer, Integer > map = new HashMap(); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (arr[i][j] == 1) { int size = getIslandSize(arr, i, j, islandId); map.put(islandId++, size); } } } return map.size(); } private static int getIslandSize(int[][] grid, int i, int j, int islandId) { if (i < 0 || j < 0 || i >= grid.length || j >= grid[0].length || grid[i][j] != 1) return 0; grid[i][j] = islandId; int left = getIslandSize(grid, i, j - 1, islandId); int right = getIslandSize(grid, i, j + 1, islandId); int up = getIslandSize(grid, i - 1, j, islandId); int down = getIslandSize(grid, i + 1, j, islandId); int a = getIslandSize(grid, i - 1, j - 1, islandId); int b = getIslandSize(grid, i + 1, j + 1, islandId); int c = getIslandSize(grid, i + 1, j - 1, islandId); int d = getIslandSize(grid, i - 1, j + 1, islandId); return left + right + up + down + 1 + a + b + c + d; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int m = sc.nextInt(); int n = sc.nextInt(); int arr[][] = new int[m][n]; for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) arr[i][j] = sc.nextInt(); System.out.println(countIsland(arr)); } }
Question 3 : Movie
After Watching a movie at PVR, Adil is pondering over the number of ways in which he can pay for the movie. He has x1, x2, x3, x4 coins of values 1,2,5 and 10 respectively. He wants to determine the number of ways in which he can pay an amount A.
You need to fill in a function that returns the number of ways to pay total amount
Input Specifications:
Input 1: An integer value denoting the total amount to be paid
Output Specification:
Return an Integer value denoting the number of ways to pay the total amount
Example1:
Input1: 40
Output : 195
Example2:
Input1: 4
Output : 3
#include #include using namespace std; int coinsExchange(int amt, int *deno, int n, int *dp) { // base case if (amt == 0) { return dp[amt] = 0; } if (dp[amt] != -1) { return dp[amt]; } // recursive case int ans = INT_MAX; for (int i = 0 ; i < n ; i++) { if (amt >= deno[i]) { int sa = coinsExchange(amt - deno[i], deno, n, dp); if (sa != INT_MAX) { ans = min(sa + 1, ans); } } } return dp[amt] = ans; } int main() { int deno[4] = {1, 2, 5, 10}; int amt; cin>>amt; int *dp = new int[amt + 1]; for (int i = 0 ; i <= amt ; i++) { dp[i] = -1; } cout << coinsExchange(amt, deno, 4, dp) << endl; return 0; }
import java.io.*; import java.util.*; public class Coin { static int count( int S[], int m, int n ) { if (n == 0) return 1; if (n < 0) return 0; if (m <=0 && n >= 1) return 0; return count( S, m - 1, n ) + count( S, m, n-S[m-1] ); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int total = sc.nextInt(); int arr[] = {1, 2, 5,10}; int m = arr.length; System.out.println( count(arr, m, total)); } }
Question 4 : Binary Tree
Problem Statement – How will we represent a binary tree? We can use a bracket structure for all of the edges, like (Parentnode , Childnode). Now if we use a node in a child node more than once, the tree can not be valid. Same for the parent node, a node can not be taken more than twice in a graph as a parent node.
Suppose we see this one graph
(P,Q)(P,R)(Q,T)(R,W)(U,V)(Q,S)(R,U)(U,Z)(S,I)(W,Y)
A tree with those edges may be illustrated in many ways.Here are two:
P P
/ \ / \
Q R Q R
/ \ / \ / \ / \
S T U W S T U W
\ / \ \ / / \ \
I V Z Y I Z V Y
The following is a recursive definition for the S-expression of a tree.
S-exp(node)=(node->val(S-exp(node->first_child))(S-exp(node->second_child))),if node
!NULL=””,node= =NULL
Where first_child->valval(first_child->val is lexicographically than second_child->val)
This tree can be represented in S-expression in multiple ways.The lexicographically smallest way of expressing it as follows:
P(Q(S(I))(T))(R(U(V)(Z))(W(Y))))
Translate the node-pair representation into its lexicographically smallest S-expression or report any errors that do not conform to the definition of the binary tree.
The List of errors with their codes is as follows:
Error Reason
Code Stopped1 More than 2 children
Code Stopped2 Duplicate Edges
Code Stopped3 Cycle Present(node is direct descendant of more than one node)
Code Stopped4 Multiple Roots
Code Stopped5 Any other error
Functional Description
Complete the function sExpression in the editor below.
- The function must return either the lexicographically lowest S-expression or the lexicographically lowest error code as a string.
sExpression has the following parameter(s):
- Nodes:a string of space-separated parenthetical elements,each of which contains the name of two nodes connected by a comma.
Constraints:
- All node names are single characters in the range ascii[A-Z].
- The maximum node count is 26.
- There is no specific order to the input (parent,child) pairs.
>Input Format for Custom Testing
>Sample Case 0
Sample Input 0
(B,D) (D,E) (A,B) (C,F) (E,G) (A,C)
Sample output 0
(A(B(D(E(G))))(C(F)))
Explanation 0
A representation of tree is as follows:
A
/ \
B C
/ \
D F
/
E
/
G
>Sample Case 1
Input:
(C,E)(D,F)(A,B)(A,C)(B,K)
Output:
A(B(K))(C(E)))D(F))
#include <bits/stdc++.h> using namespace std; string s, ans = ""; unordered_map < char, int >root, child, flag; //rootOf,childOf map < pair < char, char >, int >duplicateedgecheck; //Duplicate edge check unordered_map < char, char >par, ch[2], monitor; char find (char c) { if (monitor[c]) return monitor[c]; if (root[c] == 0) return monitor[c] = c; return monitor[c] = find (par[c]); } void makeans (char c) { if (flag[c] == 0) { ans += c; flag[c]++; if (child[c] == 2) { ans += '('; makeans (min (ch[0][c], ch[1][c])); ans += '('; makeans (max (ch[0][c], ch[1][c])); } else for (int i = 0; i < child[c]; i++) { ans += '('; makeans (ch[i][c]); } ans += ')'; } } int main () { getline (cin, s); for (int i = 0; i < 26; i++) { root['A' + i] = -5; } for (int i = 0; i < s.length (); i++) if (s[i] == '(') { child[s[i + 1]]++; root[s[i + 3]] = root[s[i + 3]] == -5 ? 1 : root[s[i + 3]]++; duplicateedgecheck[ { min (s[i + 1], s[i + 3]), max (s[i + 1], s[i + 3])} ]++; root[s[i + 1]] == -5 ? root[s[i + 1]] = 0 : 1; ch[0][s[i + 1]] == '\0' ? ch[0][s[i + 1]] = s[i + 3] : ch[1][s[i + 1]] = s[i + 3]; par[s[i + 3]] = s[i + 1]; if (child[s[i + 1]] > 2) { cout << "Code Stopped1"; return 0; } if (duplicateedgecheck[ { min (s[i + 1], s[i + 3]), max (s[i + 1], s[i + 3])} ] > 1) { cout << "Code Stopped2"; return 0; } if (find (s[i + 1]) == find (s[i + 3]) && s[i + 1] != par[s[i + 3]]) { cout << "Code Stopped3"; return 0; } if (root[s[i + 3]] > 1) { cout << "Code Stopped4"; return 0; } if (s[i + 4] != ')' || s[i + 2] != ',') { cout << "Code Stopped5"; return 0; } //i+=5; } for (int i = 0; i < 26; i++) { if (root['A' + i] == 0) makeans ('A' + i); } cout << ans; }
Question 5
Vira writes an apology letter to anu. However, before Anu can read it, Vira’s enemy Rohan takes it and rotates the characters of each word left to right N times. Find the number of words that remain the same even after this shifting of letters.
Input Specification:
- input1: String of words
- input2: N, number of times rotation happens
Output Specification:
- Your function should return the number of correct words.
Example 1:
input1: llohe ereth
input2: 2
Output : 2
Example 2:
input1: Sorry
input2: 2
Output : 0
#include<bits/stdc++.h> using namespace std; // In-place rotates s towards left by d void leftrotate(string &s, int d) { reverse(s.begin(), s.begin()+d); reverse(s.begin()+d, s.end()); reverse(s.begin(), s.end()); } // Driver code int main() { string str1; cin>>str1; Int n; cin>>n; leftrotate(str1, n); cout << str1 << endl; return 0; }
import java.util.*; import java.io.*; public class Apology{ static String leftrotate(String str, int d) { String ans = str.substring(d) + str.substring(0, d); return ans; } public static void main(String args[]) { Scanner sc = new Scanner(System.in); String str1 = sc.nextLine(); int n = sc.nextInt(); String rotate = leftrotate(str1, n); char ch1[] = str1.toCharArray(); char ch2[] = rotate.toCharArray(); int count = 0; for(int i=0 ; i<str1.length() ; i++){ if(ch1[i] == ch2[i]) count++; } System.out.print(""+count); } }
FAQs related to MPL Coding Questions
Question 1: How many rounds are there in MPL Recruitment Process?
There are total of 4 rounds in the MPL Recruitment Process which include:-
- Online Aptitude Test
- Group Discussions
- Technical Interview
- HR Interview
Question 2: What kind of roles are available at MPL in India?
MPL offers a variety of roles across different domains, including Game Development, Data analytics, artificial intelligence, machine learning and cloud computing.
Question 3: Does MPL asks coding questions in Recruitment Process?
Yes, Coding Questions are included in MPL Recruitment Process but according to different job profiles.
Question 4: How can I apply for a job at MPL?
You can visit the Careers page on the MPL website to find current job openings. Or you can contact your College’s Training & Placement Cell to give necessary details of On Campus Hiring conducted by MPL in various colleges.
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