Ishan.nitj's blog

By Ishan.nitj, history, 8 years ago, In English

Since no one has put the blog for hackerrank 101 hack , I am putting it. Link: https://www.hackerrank.com/contests/101hack45/challenges

The contest starts in 23 minutes.Lets discuss the problems thereafter EDIT:Official Blog is here: http://mirror.codeforces.com/blog/entry/49827

Full text and comments »

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

By Ishan.nitj, history, 8 years ago, In English

I am trying to submit this code http://mirror.codeforces.com/contest/67/submission/23471534 but it gives RTE on test case 2. It runs accurately on my machine and I have tested it on ideone also. Any reasons

Full text and comments »

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

By Ishan.nitj, history, 8 years ago, In English

We were trying to solve this problem using divide And conquer approach but could not solve it. Any clue on how to do it?

https://www.codechef.com/AMR16MOS/problems/AMR16B

Full text and comments »

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

By Ishan.nitj, history, 8 years ago, In English

Problem My Solution

Let us consider the string in problem as S and the string that we generate as T.

What my solution does it:

Solve(1,S.size()):

Ans=0

1)If the first and last character of S and T are same,Ans+=Solve(2,s.size()-1)

2)If the first and last character of T are greater than S, then we can place any charcters from [2,S.size()-1].

3)If first character of T =first character of S,but last character of T is > last character of S,then we have to make sure that T[2,S.size()-2]>=S[2,S.size()-2]

4)If first character of T > first character of S,but last character of T is = last character of S,then we have to make sure that substring T[S.size()-2,2]>=S[S.size()-2,2]

Base Conditions: Solve(x,y) if x<y return 0
Solve(x,y) if x==y return ('Z'-S[x])

Here A[x,y] denotes substring of A from index x to y inclusive.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Ishan.nitj, history, 8 years ago, In English

Problem Statement
My submission

The question is quite staright forward.However i dont know on why I am getting WA.Can any one give a test case where my sol. is giving give WA?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Ishan.nitj, history, 8 years ago, In English

https://code.google.com/codejam/contest/5254487/dashboard#s=p2
This problem was in Google APAC Round B.I could solve only for small input in O(n^2).Any idea for large input ?

Full text and comments »

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

By Ishan.nitj, history, 8 years ago, In English

I am trying to solve this problem http://mirror.codeforces.com/contest/652/problem/D. My approach is http://mirror.codeforces.com/contest/652/submission/18906153 which is nlogn and should pass the time constraint.However I am getting TLE. I think this might be due std::distance which i have used to calculate distance b/w 2 elements in set.Please HELP.

Full text and comments »

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

By Ishan.nitj, history, 8 years ago, In English

This topcoder question appeared in SRM 689 https://community.topcoder.com/stat?c=problem_statement&pm=14247

This is my code http://ideone.com/443DkL but i am getting TLE for large inputs like : abcdefghijklmno xxxxxxxxxxxxxxx

I have written the code very clearly and it is easy to understand.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Ishan.nitj, history, 8 years ago, In English

I have been struggling with dynamic programming questions involving bitmasking. Although i have found questions on codeforces but many of them contain little explanation. Can someone give good resources and questions which contain good explanation to understand?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Ishan.nitj, history, 9 years ago, In English

Can any one explain the logic behind this question from hackerearth: Samu had come up with new type of numbers, she named them Special Coprime numbers. Special Coprime numbers follow a property : A number N is said to be Special Coprime if sum of its digits as well as the sum of the squares of its digits are coprime to each other.

Now she started counting numbers that are Special Coprime. But soon she get bored and decided to write a program that can help do it. Now she want you to help her to find count of such numbers between L and R , where both L and R are included.

Input Format : First line contain number of test cases T. Each test case contains two space separated integers L and R, denoting the range in which you need to find the count of Special Coprime numbers.

Output Format : For each test case you need to print the count of such numbers in range [L,R]

Constraints : 1 ≤ T ≤ 1e3 1 ≤ L ≤ R ≤ 1e18

Link: https://www.hackerearth.com/problem/algorithm/samu-and-special-coprime-numbers/description/

Full text and comments »

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