File tree 1 file changed +0
-24
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-24
lines changed Original file line number Diff line number Diff line change 1
1
package com .fishercoder .solutions ;
2
2
3
- /**
4
- * 365. Water and Jug Problem
5
- *
6
- * You are given two jugs with capacities x and y litres.
7
- * There is an infinite amount of water supply available.
8
- * You need to determine whether it is possible to measure exactly z litres using these two jugs.
9
- *
10
- If z liters of water is measurable, you must have z liters of water contained within one or both buckets by the end.
11
-
12
- Operations allowed:
13
-
14
- Fill any of the jugs completely with water.
15
- Empty any of the jugs.
16
- Pour water from one jug into another till the other jug is completely full or the first jug itself is empty.
17
-
18
- Example 1: (From the famous "Die Hard" example)
19
- Input: x = 3, y = 5, z = 4
20
- Output: True
21
-
22
- Example 2:
23
- Input: x = 2, y = 6, z = 5
24
- Output: False
25
-
26
- */
27
3
public class _365 {
28
4
29
5
public static class Solution1 {
You can’t perform that action at this time.
0 commit comments