dheetCoder's blog

By dheetCoder, history, 20 months ago, In English

Suppose we have given a permutation of length n. Can we find the count of a specific binary string of length n-1. Such that for each permutation p we increment the count of binary string b, where b[i]=='1' if p[i+1]>p[i] else '0' for each i from 0...n-2. For n=5 I have runned the bruteforce code

Code

Getting the output

result

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By dheetCoder, history, 20 months ago, In English

My grandfather ask me this puzzle problem.

Three friends were traveling together and one night they made some "littis" and went to sleep without eating any "littis". During the night, one of the friends woke up and divided the "littis" into three equal parts, with one extra "litti" left over. He gave the extra "litti" to the dog and ate his one out of three part and he went back to sleep. After some time, another friend woke up and he also divided the "littis" into three equal parts, with one "litti" left over. He gave the extra "litti" to the dog, ate his one part, and went back to sleep. The third friend woke up and did the same thing. In the morning, all three friends woke up and divided the remaining "littis" into three equal parts, with one left over. They ate their parts, and gave the extra "litti" to the dog. Finally, no "littis" were left. Can you guess how many "littis" there were originally?

Litti

I have tried bruteforce on number of littis and found the number as sequence of 79,160,241…

Can someone proof how this patterns of number is following ??

Full text and comments »

  • Vote: I like it
  • +16
  • Vote: I do not like it

By dheetCoder, history, 21 month(s) ago, In English

Which college courses do you find very helpful for CP ??. For me it was Number theory and cryptography . Plz comment below.

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it