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?

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 .

@vijju123 @kaushal101 @mohit_negi @taran_1407 @vivek_1998299 @meooow @john_smith_3

Thanks in advance :)

asked 14 Mar '18, 16:21

harrypotter0's gravatar image

4★harrypotter0
318110
accept rate: 1%

edited 14 Mar '18, 16:44


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.

link

answered 14 Mar '18, 16:54

taran_1407's gravatar image

6★taran_1407
3.9k2895
accept rate: 22%

Will look into it.

(14 Mar '18, 17:41) harrypotter04★
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:

×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