Update appNew update is available. Click here to update.
Topics

Burgers At Ninja-Cafe

Easy
0/40
Average time to solve is 15m
profile
Contributed by
0 upvote
Oracle

Problem statement

You are a chef at NINJA-CAFE. There are 2 types of burgers made there. The ingredients of different burgers are as follows:

Jumbo Burger: 4 tomato slices and 1 cheese slice.
Small Burger: 2 Tomato slices and 1 cheese slice.

You are given two integers 'TOMATO_SLICES' and 'CHEESE_SLICES' indicating the number of tomato slices and cheese slices available.

Your task is to return an array/list [JUMBO_BURGERS, SMALL_BURGERS] indicating the number of Jumbo Burgers and Small Burgers you can make such that the number of remaining 'TOMATO_SLICES' and the number of remaining 'CHEESE_SLICES' each equals to 0. If it is not possible to make the remaining 'TOMATO_SLICES' and 'CHEESE_SLICES' equal to 0 return [-1, -1].

For Example :

Given:-
‘TOMATO_SLICES’ = 6 and ‘CHEESE_SLICES’ = 2.
Therefore 1 Jumbo Burger and 1 Small Burger can be formed using the available slice completely.
Hence the answer is  [1, 1].
Detailed explanation ( Input/output format, Notes, Images )
Sample Input 1 :
2
6 2
7 2
Sample Output 1 :
1 1
-1 -1
Explanation of Sample Input 1 :
For first test case :  
‘TOMATO_SLICES’ = 6 and ‘CHEESE_SLICES’ = 2. Therefore 1 Jumbo Burger and 1 Small Burger can be made.
Hence the answer is  [1, 1].

For Second Test case:
TOMATO_SLICES’ = 7 and ‘CHEESE_SLICES’ = 2. Therefore 1 Jumbo Burger and 1 Small Burger can be formed but even after than 1 ‘TOMATO_SLICE’ will remain unused.
Hence the answer is [-1, -1].
Sample Input 2 :
2
16 7
0 0
Sample Output 2 :
1 6
0 0
Full screen
Console