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

×

# Can anyone help me with Task on String Counting from MNM Online Programming Contest?

 0 Hello friends can someone tell me how to approach this problem ?? My solution :: Approach was to make a list of all possible permutations and then check for it's presence in the string given but it 's giving wrong answer . Thanks in advance :) asked 14 Mar '18, 16:21 318●1●10 accept rate: 1%

One Answer:
 0 Since we want to count frequency of any permutation of W, we just need to check for frequecny of each element. See, if w is "aaab", then our answer will be number of stubstring of s of length 4, which have same frequency of all characters. This can be done using sliding window and frequency array. Ur solution is correct, but very slow. Also, u need to count occurances. Increase answer by no of occurances of i in b, not by 1. answered 14 Mar '18, 16:54 3.9k●28●95 accept rate: 22% Will look into it. (14 Mar '18, 17:41)
 toggle preview community wiki:
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:

×2,718
×2,356
×643
×69
×38
×15
×4

question asked: 14 Mar '18, 16:21

question was seen: 190 times

last updated: 14 Mar '18, 17:41