abhaygupta08/Hacktober-2022

Palindrome Flipping Problem : Codechef starters 60 in java

Closed this issue · 2 comments

@abhaygupta08 please assign me this under Hacktoberfest 2022.

Problem Description :
Chef has a binary string SS of length NN.

In one operation, Chef can:

Select two indices ii and jj (1 \le i, j \le N, i \ne j)(1≤i,j≤N,i=j) and flip S_iS
i

and S_jS
j

. (i.e. change 00 to 11 and 11 to 00)
For example, if S = 10010S=10010 and chef applys operation on i = 1i=1 and j = 3j=3 then: \underline{1}0\underline{0}10 \rightarrow 00110
1

0
0

10→00110.

Find if it is possible to convert SS to a palindrome by applying the above operation any (possibly zero) number of times.

Note: A string is called a palindrome if it reads the same backwards and forwards, for e.g. 1000110001 and 01100110 are palindromic strings.
Screenshot (76)

assign me this one