You are not logged in. Please login at www.codechef.com to post your questions!

×

is my logic wrong for fibonacci string or am i missing some cases

from collections import Counter for _ in range(int(input())):

 s=input()
 a=list(s)
 l=[]
 l1=[]
 flag=0
 count=1


 #print(Counter(a))
 a1=Counter(a)
 v=(max(a1))

 for k in a1:
        #print(a1[k])
        l1.append(a1[k])
 #print("l1",l1)
 y=max(l1)
 #print("y",y)
 l1.remove(y)
 #print("l1",l1)

 if len(l1)<2:
        print("Dynamic")
        flag=1
 for i in range(len(l1)-1):
    for j in range(i+1,len(l1)):
        #print(l1[i],l1[j])
        #print(l1[i]+l1[j],y)
        if (l1[i]+l1[j])==y:
            print("Dynamic")
            flag=1
            break
    if flag==1:
            break
 if flag==0:
    print("Not")

asked 16 Sep '18, 22:33

thirumalai15's gravatar image

2★thirumalai15
1
accept rate: 0%


Can you post the link of the question?

link

answered 17 Sep '18, 16:14

omorxing's gravatar image

2★omorxing
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×775
×630

question asked: 16 Sep '18, 22:33

question was seen: 56 times

last updated: 17 Sep '18, 16:14