Problem:
[Kick Start - Google’s Coding Competitions](http://Countdown - Kickstart Round C)
I was able to solve this problem in O(n^2) solution but I at first I tried another method and it gave me wrong answers. My logic was to take array as string and then to create a string, of which the count is the answer. It was way faster than applying two loops. Maybe the code is wrong or maybe my logic. Please have look at it once and I would be pleased if someone tell me the error.
My code:
> for test in range(0,int(input())): > n,k=[int(x) for x in input().split()] > arr=input() > array_to_check=[str(x) for x in range(k,0,-1)] > string_to_check=' '.join(array_to_check) > print('Case #{}: {}'.format(test+1,arr.count(string_to_check)))