Infra Market Coding Questions and Answers
Infra Market Coding Questions with Solutions
In Infra Market Coding Questions and Answers page, you will find out Coding Questions 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.
About Infra Market
Infra.Market was Co-Founded by Souvik Sengupta and Aaditya Sharda in 2016. It is the leading Infrastructure Constructions and Solutions Company that provides a vast variety of construction materials for large-scale construction activities. Their focus is mainly on providing a wide range of building materials as well as products that are used to enhance the Interior and Exterior spaces of the Infrastructures.
About Infra Market Recruitment Process
The Infra Market Recruitment Process consists of the following steps :
- Online Coding Assessment [ DSA Based ]
- Technical Interview
- HR Interview
Infra Market | Related Information |
---|---|
Position : | Software Engineer Testing (QA Engineering) |
Course : |
|
Eligibility Criteria / Academic Qualification Required : |
|
Infra Market CTC Breakdown : |
|
Selection Process : |
|
Joining Location : | Bangalore |
Infra Market Job Description
Software Engineer - Testing (QA Engineering)
This Job Role requires :
- Knowledge in Core Java.
- Analytical and logical skills.
- Better understanding of Manual & Automation Testing and writing test scenarios and test cases.
- Good understanding on SDLC and STLC.
- Good in Analyzing bugs and errors found during tests.
- Good knowledge of RDBMS and nice to have exposure to NoSQL database technologies.
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Infra Market Coding Questions and Answers
Question 1 : Copycat
Problem Statement :
Ashish was copying from Rahit in the exam. So, Rahit told him to change the answers a little bit so that the examiner cannot find the fraud. But silly Ashish in the way started to change all the answers that were needed. He shuffled the letters in each word in a way where the maximum number of letters were misplaced.
For a given word, find the maximum difference that Ashish can generate between his answer and Rahit’s answer.
Suppose Rahit wrote “car” for an answer, Ashish can write “acr” with difference 2, or “arc” with differnece 3.
Note That: The letters are all in lowercase.
Input Format:
First line containing an integer n, number of words.
Then, n numbers of lines as the query words.
Output:
N number of lines with an integer each denoting possible maximum difference.
Sample Input:
4
abababa
bbj
kj
kk
Sample Output:
6
2
2
0
#include<bits/stdc++.h> using namespace std; string s, s1; int n; int func() { if (n <= 1) return 0; int ans = 0, c = 0; sort(s.begin(), s.end()); for (int i = 0; i < n; i++) if (s1[i] != s[i]) c++; ans = max(ans, c); c = 0; while (next_permutation(s.begin(), s.end())) { for (int i = 0; i < n; i++) if (s1[i] != s[i]) c++; ans = max(ans, c); c = 0; } return ans; } int main() { int t; cin >> t; while (t--) { cin >> s; s1 = s; n = s.length(); cout << func() << endl; } return 0; }
import java.util.*; class Main { public static String swapString(String s, int i, int j) { char[] b = s.toCharArray(); char temp; temp = b[i]; b[i] = b[j]; b[j] = temp; return String.valueOf(b); } public static void generatePermutation(String s, int start, int end, HashSet < String > set) { if (start == end - 1) set.add(s + " "); else { for (int i = start; i < end; i++) { s = swapString(s, start, i); generatePermutation(s, start + 1, end, set); s = swapString(s, start, i); } } } public static int maxDiff(String str, String s) { int c = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == str.charAt(i)); else c++; } return c; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] a = new String[n]; for (int i = 0; i < n; i++) { a[i] = sc.next(); } for (int i = 0; i < n; i++) { HashSet < String > set = new HashSet < String > (); String s = a[i]; generatePermutation(s, 0, s.length(), set); int max = 0; int k = 0; for (String str: set) { k = maxDiff(str, s); max = Math.max(max, k); } System.out.println(max); } } }
from itertools import permutations def solve(x, n): ans = 0 for i in permutations(x): c = 0 for j in range(n): if x[j] != i[j]: c += 1 ans = max(ans, c) return ans t = int(input()) for i in range(t): s = input() print(solve(s, len(s)))
Question 2 :Borrow Number
Problem Statement :
You have two numbers number1 and number2, your job is to check the number of borrow operations needed for subtraction of number1 from number2. If the subtraction is not possible then return the string not possible.
Example :
754
658
Answer :
2
654
666
Answer :
Not possible
#include &bits/stdc++.h> using namespace std; int main() { string s1, s2; int c = 0, f = 0; cin >> s1 >> s2; if (stoi(s1) < stoi(s2)) { cout << "Impossible"; } reverse(s1.begin(), s1.end()); reverse(s2.begin(), s2.end()); for (int i = 0; i < s1.length(); i++) if (s1[i] < s2[i]) { f = 1; c++; } else if (s1[i] == s2[i]) { if (f == 1) { c++; } f = 0; } else f = 0; cout << c; }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int number1 = sc.nextInt(); int number2 = sc.nextInt(); int count = 0; if (number1 < number2) { System.out.println("Not possible"); } else { boolean flag = false; while (number1 != 0 && number2 != 0) { int temp1 = 0; int temp2 = number2 % 10; if (flag) temp1 = number1 % 10 - 1; else temp1 = number1 % 10; if (temp1 < temp2) { count++; flag = true; } else flag = false; number1 = number1 / 10; number2 = number2 / 10; } System.out.println(count); } } }
number1 = int(input()) number2 = int(input()) count = 0 if number1 < number2: print("Not possible") else: flag = 0 while number1 != 0 and number2 != 0: temp1 = 0 temp2 = number2 % 10 if flag: temp1 = number1 % 10 - 1 else: temp1 = number1 % 10 if temp1 < temp2: count += 1 flag = 1 else: flag = 0 number1 = number1 // 10 number2 = number2 // 10 print(count)
Question 3 : Capitalize/Decapitalize
Problem Statement :
You’re given a function that accepts the following, a string1, its length and a character c. Your job is to replace all the occurrences of character c in string1 and capitalize it or decapitalize it based on the character c.
Input :
hello world
l
Output :
heLLo worLd
Input :
prepinsta
p
Output :
PrePinsta
#include <bits/stdc++.h> using namespace std; int main() { string s; getline(cin, s); char k; cin >> k; for (auto i: s) if (i == k) { if (i > 95) cout << char(i - 32); else cout << char(i + 32); } else cout << i; }
import java.util.Scanner; public class Main { public static void change(String str, char c, int len) { char[] ch = str.toCharArray(); for (int i = 0; i < ch.length; i++) { if (c == ch[i]) { if (Character.isUpperCase(ch[i])) { ch[i] = Character.toLowerCase(ch[i]); } else if (Character.isLowerCase(ch[i])) { ch[i] = Character.toUpperCase(ch[i]); } } } System.out.print(new String(ch)); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); char c = sc.next().charAt(0); int len = str.length(); change(str, c, len); } }
ss = input() k = input() if k.isupper(): s = s.replace(k, chr(ord(k) + 32)) else: s = s.replace(k, chr(ord(k) - 32)) print(s)
Question 4 : Total Distinct Money
Problem Statement :
You woke up from sleep and found yourself in the 0th row and 0th column of a grid. every other square in a grid has some amount of money kept there. If you are given the matrix with all the values left in the cells, you have to find how many different ways are there to rich the r-1 th , c-1 th cell and the sum of all possible amount of money you will have each time if you bring all the money kept in places in the cell.
Note that, if you are in i,j th cell, either you can go i+1, j th cell or you can go i,j+1 cell.
Again, the 0,0th grid and the n-1,m-1 th grid will have 0 value.
Input Format:
Two integers R and C meaning the number of rows and columns.
Next R lines C space separated integers denoting the total grid.
Output Format:
First Line denoting the distinct ways to rich.
Next line denotes the total money if you use all possible distinct ways (Given that if you take the money from a cell, the money is readded in the cell).
Sample Input:
3 3
0 2 3
1 3 2
1 1 0
Sample Output:
4
21
Explanation:
The all possible totals are:
0 -> 2 -> 3 -> 2 -> 0 Total = 7
0 -> 2 -> 3 -> 2 -> 0 Total = 7
0 -> 2 -> 3 -> 1 -> 0 Total = 6
0 -> 1 -> 3 -> 2 -> 0 Total = 6
0 -> 1 -> 3 -> 1 -> 0 Total = 5
0 -> 1 -> 1 -> 1 -> 0 Total = 3
There are 4 distinct ways and the total is 21
#include<bits/stdc++.h> using namespace std; vector < vector < int >> a; int n, m, t; int ans = 0, sum = 0; map < int, int > mm; void answer(int i, int j, int num, vector < vector < int >> a2) { if (i == n - 1 && j == m - 1) { if (mm[num] == 0) { mm[num] = 1; ans++; sum += num; } return; } if (i == n - 1) { answer(i, j + 1, num + a2[i][j], a2); return; } if (j == m - 1) { answer(i + 1, j, num + a2[i][j], a2); return; } answer(i + 1, j, num + a2[i][j], a2); answer(i, j + 1, num + a2[i][j], a2); } int main() { cin >> n >> m; vector < vector < int >> arr(n, vector < int > (m)); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> arr[i][j]; a = arr; answer(0, 0, 0, a); cout << ans << endl << sum; }
import java.util.*; public class Main { static ArrayList < ArrayList < Integer >> a; static int n, m, t; static int ans = 0, sum = 0; static Map < Integer, Integer > mm = new HashMap < Integer, Integer > (); static void answer(int i, int j, int num, ArrayList < ArrayList < Integer >> a2) { if (i == n - 1 && j == m - 1) { if (mm.get(num) == null) { mm.put(num, 1); ans++; sum += num; } return; } if (i == n - 1) { answer(i, j + 1, num + a2.get(i).get(j), a2); return; } if (j == m - 1) { answer(i + 1, j, num + a2.get(i).get(j), a2); return; } answer(i + 1, j, num + a2.get(i).get(j), a2); answer(i, j + 1, num + a2.get(i).get(j), a2); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); m = sc.nextInt(); ArrayList < ArrayList < Integer >> arr = new ArrayList < ArrayList < Integer >> (); for (int i = 0; i < n; i++) { ArrayList < Integer > temp = new ArrayList < Integer > (); for (int j = 0; j < m; j++) { temp.add(sc.nextInt()); } arr.add(temp); } a = arr; answer(0, 0, 0, a); System.out.println(ans + "\n" + sum); } }
from typing import DefaultDict sum = 0 ans = 0 def answer(i, j, num, a2): global sum global ans if i == n - 1 and j == m - 1: if mm[num] == 0: mm[num] = 1 ans += 1 sum += num return if i == n - 1: answer(i, j + 1, num + a2[i][j], a2) return if j == m - 1: answer(i + 1, j, num + a2[i][j], a2) return answer(i + 1, j, num + a2[i][j], a2) answer(i, j + 1, num + a2[i][j], a2) mm = DefaultDict(int) n, m = map(int, input().split()) a2 = [] for j in range(n): a2.append(list(map(int, input().split()))) answer(0, 0, 0, a2) print(ans) print(sum)
Question 5 :Make It Palindrome
Problem Statement :
You’re given a string, you’ve to print additional characters needed to make that string a palindrome.
A Palindrome is a sequence of characters that has the property of reading the same in either direction.
Input :
abede
Output :
ba
Sample Input :
abcfe
Sample output :
fcba
#include <bits/stdc++.h> using namespace std; bool Pal(string s) { string s1 = s; reverse(s1.begin(), s1.end()); return s1 == s; } int main() { string s; getline(cin, s); int i; for (i = 0; i < s.length() - 1; i++) if (Pal(s.substr(i, s.length() - i))) break; s = s.substr(0, i); reverse(s.begin(), s.end()); cout << s; }
import java.util.*; public class Main { public static boolean isPalindrome(String str) { char arr[] = str.toCharArray(); for (int i = 0, j = arr.length - 1; i < j; i++, j--) if (arr[i] != arr[j]) return false; return true; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); String res = ""; for (int i = 0; i < str.length(); i++) { if (isPalindrome(str.substring(i, str.length()))) { res = str.substring(0, i); break; } } System.out.println(new StringBuilder(res).reverse()); } }
def ispalindrome(s): return s == s[::-1] def solve(s): if ispalindrome(s): return None for i in range(len(s)): x = s[:i][::-1] if ispalindrome(s + x): return x s = input() print(solve(s))
FAQs related to Infra Market Coding Questions
Question 1: How many rounds are there in Infra Market Hiring Process?
There are in total three rounds in the Infra Market Hiring Process which includes:-
- Coding Assessments
- Technical Interview
- HR Interview
Question 2: Is Coding questions asked in Infra Market Recruitment Process?
Yes, Coding Questions are included in Online Assessment and Technical Interview of Infra Market.
Question 3: What does Infra Market really do ?
Infra.Market is a technology-driven B2B platform that provides end-to-end solutions for construction materials and infrastructure projects. Infra.Market works with construction and infrastructure companies to help them streamline their procurement processes and improve the quality and reliability of their supply chain.
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