Skip to content

Commit 10cb09c

Browse files
Update SilverAndGold.java
Added problem statement at start of file
1 parent bf66fff commit 10cb09c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

SilverAndGold.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/* ************
2+
Problem statement:
3+
SILVER AND GOLD
4+
5+
There are N coins kept in a line.
6+
Each coin has two sides - one is colored gold
7+
and the other silver. You can flip two adjacent
8+
coins any number of times. You need to make
9+
the gold-colored side of every coin facing up.
10+
You are given the initial status of coins
11+
in a binary string s where 1 represents the
12+
gold side facing up and 0 represents the silver
13+
side facing up. If it is possible to make the
14+
gold-colored side of every coin facing up,
15+
return Yes, otherwise return No
16+
17+
Input:
18+
N = 8, s = "11001100"
19+
Output:
20+
Yes
21+
Explanation:
22+
Flipping 3rd and 4th coin together and 7th
23+
and 8th coin together will do the task.
24+
********* */
125
public class SilverAndGold{
226
//Silver and Gold Problem
327
public static String flipCoins(int N,String s) {

0 commit comments

Comments
 (0)