Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

Wipro Coding Question 5

Corona World

Corona World  is one of the coding question asked in previous wipro Elite NTH Exam. In this article, we will discuss about the corona world problem with their solution in C++ and Java.

Question 5

Dinesh is fond of video games. Due to the pandemic, he designs a video game called Corona world. In this game, the player enters the game with a certain energy. The player should defeat all the corona infected zombies to reach the next level. When time increases the zombies will increase double the previous minute. Anyhow the player can manage to fight against all the zombies. In this case, definitely the player can not achieve the promotion. Hence the player gets a superpower to destroy all the zombies in the current level when the current game time is a palindrome. Anyhow the player can manage only if he knows the time taken to get the superpower. Help the player by providing the minimum minutes needed to get the superpower by which he can destroy all the zombies. You will be provided with the starting time of the game.

Input Format:
First-line contains a string representing the starting time.

Output:
A string representing the minimum minutes needed to get the superpower.

Constraints:
Input time will be in 24 hours format

Sample Input:
05:39

Sample Output:
11

Explanation:
It takes 11 minutes for minute value to become 50, 05:50 is a palindromic time.

Sample Input :
Input
04:45

Sample Output:
65

`import java.util.*;class Solution{    public static void main(String[] args)    {           Scanner sc=new Scanner(System.in);           String str=sc.nextLine();           int hour,minute;           hour=(str.charAt(0)-'0')*10 + str.charAt(1)-'0';           minute=(str.charAt(3)-'0')*10 + str.charAt(4)-'0';           int res=0;           while(hour%10 != minute/10 || hour/10!= minute%10)             {                      minute++;                      if(minute==60)                      {                          minute=0;                          hour++;                      }                      if(hour==24)                           hour=0;                     res++;             }               System.out.println(res);    }}`
`#include<bits/stdc++.h>using namespace std;int main(){        string str;        cin>>str;        int hour,minute;        hour=(str[0]-'0')*10 + str[1]-'0';        minute=(str[3]-'0')*10 + str[4]-'0';        int res=0;        while(hour%10 != minute/10 or hour/10!= minute%10){                minute++;                 if(minute==60){                minute=0;        hour++;        }                if(hour==24)        hour=0;        res++;    }         cout<<res;        return 0;}`