Unthinkable Solutions Coding Questions & Solutions 2024, Get Interview Questions

Unthinkable Solutions Coding Questions & Solutions 2024 | Unthinkable Solutions Interview Questions | Unthinkable Solutions Coding Questions 2024 | Unthinkable Solutions Coding Questions and Answers 

Unthinkable Solutions Coding Questions & Solutions 2024: The Coding test is containing many programming languages. This Coding Test Round is evaluating your programming Skills and Coding Knowledge. The selection process contains many levels of the test. Coding Test is one of the main difficulty parts in every private sector interviews. Every Candidates mainly focused on this Coding Test. In the Private Sector Company of Unthinkable Solutions is hiring eligible employees. Many of the eligible candidates are applied in the Unthinkable Solutions Careers 2024. The Unthinkable Solutions will conducting the hiring test for each post. Here we provided the Common Unthinkable Solutions Coding Questions and Answers/ Unthinkable Solutions Interview Questions. Who are interested in the Unthinkable Solutions Hiring, they definitely prepare for the selection process. The hiring process is containing Coding Interview Round. Unthinkable Solutions will mostly ask the Unthinkable Solutions Coding questions in the C, C++, Java, Python Program. Candidates thoroughly prepare for the Languages for Unthinkable Solutions Coding Interview.

By solving the Unthinkable Solutions Coding Questions and Answers, you will clear the Coding Interview Round. Candidates must prepare for the Unthinkable Solutions Coding test. In this page you can get the Unthinkable Solutions Coding questions with Solutions, Unthinkable Solutions Interview questions, Unthinkable SolutionsCoding Question and Answers etc.,

Unthinkable Solutions Coding Questions and Answers 

Q) Problem Statement  :

You will be given a left limit and a right limit. You need to Calculate the sum of all prime numbers between a given range x and y, both inclusive.

Sample Test Case :
Input :      Output :
30             68
40

Explanation :
31 and 37 are the two prime numbers in the window.

C++ PROGRAM 

#include <bits/stdc++.h>

using namespace std;
unordered_map < int, bool > prime;
void SieveOfEratosthenes(int n) {
    for (int i = 0; i < n; i++) prime[i] = 1;
    for (int p = 2; p * p <= n; p++)
        if (prime[p] == true)
            for (int i = p * p; i <= n; i += p) prime[i] = false;
}
int main() {
    int n, m;
    int count = 0, sum = 0;
    cin >> n >> m;
    SieveOfEratosthenes(m + 1);
    for (int i = n; i <= m; i++)
        if (prime[i]) sum += i;
    cout << sum;
}

JAVA PROGRAM 
import java.util.*;
public class Main {
    public static boolean isPrime(int no) {
        if (no <= 1)
            return false;
        if (no <= 3)
            return true;
        if (no % 2 == 0 || no % 3 == 0)
            return false;
        for (int i = 5; i * i <= no; i = i + 6) {
            if (no % i == 0 || no % (i + 2) == 0)
                return false;
        }
        return true;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int sum = 0;
        for (int i = x; i <= y; i++)
            if (isPrime(i))
                sum = sum + i;
        System.out.println(sum);
    }
}

PYTHON PROGRAM 

def isPrime(n):
    if n <= 1:
        return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False
    return True


a = int(input())
b = int(input())
x = 0 if a > 2 else 2
step = 1 if (a % 2 == 0) else 0
for i in range(a + step, b + 1, 2):
    if isPrime(i):
        x = x + i
print(x)

Q) 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.

C++ PROGRAM 

#include 

using namespace std;

int main() {
  float temperature;
  cin >> temperature;
  cout << (temperature * 9) / 5 + 32;
  return 0;
}

JAVA PROGRAM 

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);
    }
}

PYTHON PROGRAM 

def ctof(c):
    return (c * 9) / 5 + 32
temperature = float(input())
ans = ctof(temperature)
print(round(ans, 2))

Q) Problem Statement  :
You are given an array, You have to choose a contiguous subarray of length ‘k’, and find the minimum of that segment, return the maximum of those minimums.
Sample input :
1 → Length of segment x =1
5 → size of space n = 5
1 → space = [ 1,2,3,1,2] 2
3
1
2

Sample output :
3
Explanation :
The subarrays of size x = 1 are [1],[2],[3],[1], and [2],Because each subarray only contains 1 element, each value is minimal with respect to the subarray it is in. The maximum of these values is 3. Therefore, the answer is 3

C++ PROGRAM 

#include <bits/stdc++.h>
using namespace std;
vector < int > arr;
int prevmin=-1;
int flag=0;
int x,n,q;

int sorting(int start,int end)
{
    if(start+1==n) {start=0;end=end-n;}
    if(start==end) return arr[start];
    return min(arr[start],sorting(start+1,end));
}

int func(int start,int end)
{
    if(flag==0) {flag++;return prevmin=sorting(start,end);}
    if(arr[start-1]==prevmin) return prevmin;
    return prevmin=(arr[end] <= prevmin)?prevmin:sorting(start,end);

}

int main()

{

    cin >> x >> n;
    int ans=0;
    for(int i=0;i < n;i++)
    {cin >> q;arr.push_back(q);}
    for(int i=0;i < n;i++)
    {
       ans=max(ans,func(i,i+x-1));
    }
    cout << ans;
}

JAVA PROGRAM 

import java.util.*;
public class DiskSpace
{
  public static void main(String[] args)
{
  Scanner sc=new Scanner(System.in);
  int x=sc.nextInt();
  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;
  int max=Integer.MIN_VALUE;

  for(int i=0;i <= n-x;i++)
 {
    min=Integer.MAX_VALUE;
    for(int j=i;j < (i+x);j++)
     min=Math.min(min,arr[j]);
   max=Math.max(min,max);     
 }
 System.out.println(max);
}
}
PYTHON PROGRAM 
n=int(input())
arr=[]
for i in range(n):
    arr.append(int(input()))
s,a=0,0
for i in arr:
    s=s+i   
    if(s < 1):
        a=a+(-1*s) 
        s=0 
print(a)

Q) Problem Statement  :
There are some groups of devils and they splitted into people to kill them. Devils make People to them left as their group and at last the group with maximum length will be killed. Two types of devils are there namely “@” and “$”
People is represented as a string “P”

Input Format:
First line with the string for input

Output Format:
Number of groups that can be formed.

Constraints:
2<=Length of string<=10^9

Input string
PPPPPP@PPP@PP$PP

Output
7

Explanation
4 groups can be formed
PPPPPP@
PPP@
PP$
PP

Most people in the group lie in group 1 with 7 members.

C++ PROGRAM 

#include <bits/stdc++.h>
using namespace std;


int main()
{
    string s;
    cin>>s;
    int a=0,mx=0;
    for(int i=0;i < s.length();i++)
    {
        a++;
        if(s[i]=='@'||s[i]=='
import java.util.*;
class Main
{
     public static void main(String[] args)
    {
          Scanner sc=new Scanner(System.in);
          String str=sc.next();
          str=str.replace("@"," ");
          str=str.replace("$"," ");
          String arr[]=str.split(" ");
          int max=0;
          for(int i=0;i < arr.length;i++)
             max=Math.max(max,arr[i].length()); 
         System.out.println(max+1);

    }
}
PYTHON PROGRAM 

s=input()
s=s.replace("@"," ").replace("$"," ")
s=s.split()
ans=[]
for i in s:
    ans.append(len(i)+1)
ans[-1]-=1 
print(max(ans))

Q) Problem Statement :

You will be given a 2d matrix. Write the code to traverse the matrix in a spiral format. Check the input and output for better understanding.

Sample Input :
Input :
5 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20

Output :

1 2 3  4 5 6 7 8 9 10 11 12 13 14  15 16 17 18 19 20

C++ PROGRAM 
#include <bits/stdc++.h>

using namespace std;

void Spiral(vector < vector < int >> a) {
  if (a.size() == 0) return;
  int m = a.size(), n = a[0].size();
  int i, k = 0, l = 0;
  while (k < m && l < n) {
    for (i = l; i < n; ++i) cout << a[k][i] << " ";
    k++;
    for (i = k; i < m; ++i) cout << a[i][n - 1] << " ";
    n--;
    if (k < m) {
      for (i = n - 1; i >= l; --i) cout << a[m - 1][i] << " ";
      m--;
    }
    if (l < n) {
      for (i = m - 1; i >= k; --i) cout << a[i][l] << " ";
      l++;
    }
  }
}

int main() {
  int r, c;
  cin >> r >> c;
  vector < vector < int >> mat(r, vector < int > (c));
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++) cin >> mat[i][j];
  Spiral(mat);
}

JAVA PROGRAM 
import java.util.*;
public class Main
{
    public static List < Integer > solve(int [][]matrix,int row,int col)
   {
      List < Integer > res=new ArrayList < Integer > ();
      boolean[][] temp=new boolean[row][col];
      int []arr1={0,1,0,-1};
      int []arr2={1,0,-1,0};
      int di=0,r=0,c=0;
      for(int i=0;i < row*col; i++)
      {
             res.add(matrix[r][c]);
             temp[r][c]=true;
             int count1=r+arr1[di];
             int count2=c+arr2[di];
            if(count1 >= 0 && row > count1 && count2 >= 0 && col > count2 && !temp[count1][count2]){
	r=count1;
                  c=count2; 
            } 
            else 
            {
                 di=(di+1)%4;
                 r+=arr1[di];
                 c+=arr2[di];
             }
      }  
     return res;
    }
    public static void main(String[] args)
   {
         Scanner sc=new Scanner(System.in);
         int m=sc.nextInt();
         int n=sc.nextInt();
         int matrix[][]=new int[m][n];
         for(int i=0;i < m;i++)
         {
                 for(int j=0;j < n;j++)
                      matrix[i][j]=sc.nextInt();
         }
       System.out.println(solve(matrix,m,n));
  }
}

PYTHON PROGRAM 

def spiralOrder(arr):
    ans = []
    while arr:
        ans += arr.pop(0)
        arr = (list(zip(*arr)))[::-1]
    return ans
arr = []
n, m = map(int, input().split())
for i in range(n):
    arr.append(list(map(int, input().split())))
print(*spiralOrder(arr))
JOB ALERT ON INSTAGRAM FOLLOW NOW>>
JOB ALERT ON YOUR EMAIL DAILY SUBSCRIBE NOW>>

Here candidates got an Unthinkable Solutions Coding questions with solutions/ Unthinkable Solutions Interview Questions 2024 etc., Aspirants or Examiners kindly check the dailyrecruitment.in site for more informative updates.

Govt Jobs by Qualifications

Education & Vacancies Salary Apply Link
10th Pass Govt Jobs - 5,000 Vacancies Rs. 5,200 - 63,200 Apply Now
12th Pass Govt Jobs - 18,000+ Vacancies Rs. 5,200 - 92,300 Apply Now
ITI Pass Jobs - 3,500 Vacancies Rs. 5,200 - 35,000 Apply Now
Any Graduate Jobs - 19,100 Vacancies Rs. 5,200 - 92,300 Apply Now
Central Govt Jobs Rs. 5,200 - 17,000 Apply Now
Bank Jobs - 1,000 Vacancies Rs. 5,200 - 29,200 Apply Now
Diploma Jobs - 9,300 Vacancies Rs. 5,200 - 35,000 Apply Now
BTech/BE Jobs - 18,000 Vacancies Rs. 15,000 - 1,00,000 Apply Now
Data Entry Jobs - 1,300 Vacancies Rs. 5,200 - 29,200 Apply Now
Private Jobs Rs. 10,000 - 67,700 Apply Now