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


why do i get wrong answer in the following question (CLFIBD|python3.6)

Question code: CLFIBD

My code:for i in range(int(input())): str1=input() l=list(str1) s=set(l) l2=[] if len(s)<3: print("Dynamic") else: for x in s: a=l.count(x) l2.append(a) l2.sort() b=len(l2) ans=True for y in range(0,b-2): if l2[y]+l2[y+1]==l2[y+2]: ans=ans and True else: ans=ans and False if ans ==True: print ("Dynamic") else: print ("Not")

asked 07 Nov '18, 19:31

v_shah's gravatar image

accept rate: 0%

edited 07 Nov '18, 19:35

You need to take into account this case:


which is Dynamic under the permutation (b,a,c,d).


answered 07 Nov '18, 20:00

joffan's gravatar image

accept rate: 13%

Oh correct. Thanks a lot

(08 Nov '18, 00:17) v_shah2★
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 07 Nov '18, 19:31

question was seen: 85 times

last updated: 08 Nov '18, 00:17