How was HackWithInfy round 2

code for slay the dragons

Thanks a lot :slight_smile:

Hii neeraj… I want to know how many questions u did?in round 1 and 2

all 3 in both rounds.

no problem :slight_smile:

Hey , did anyone solved this question in hackwithinfy round2

Given L , R ( 1<=L,R <= 1000000000000000000) . Count the numbers in [L,R] such that each number satisfies two properties

  • The total count of odd digits are even

  • The total count of even digits are odd

Do not consider zero in MSB position

Testcase :
1 9
Output :
4

Explanation :

The numbers that satisfy both the properties are 2,4,6,8 . In each of these numbers , the count of odd digits are even (i.e 0 ) and count of even digits are odd (i.e 1 )

Thanks in advance :slight_smile:

I have done 2 questions correctly. My third question is "colouring grid ".It is problem of permutation and combination. any one done this? can anyone provide me solution of this question?

3rd present on net Google it

hey guys i have try to solve one question but i end up with time limit exceed in python . so help me how to remove this error in future.only few test cases run

I don’t know about the contest and I didn’t solve this question but I can think of a solution using digit DP. I think rather than explaining digit DP here and then the solution, I would recommend you to read about digit DP on the internet and see a few questions on it. You should be able to get the solution of the given problem after that yourself. If not, then let me know.

1 Like

Okay !! Thanks :slight_smile:

Which question? I couldn’t find any on the internet.

Did anyone solved the “Find the number of pairs that add and give a prime number” question?

Color Wala question on net.

i competed in hackwithinfy last year and in 2nd round only those were selected who cleared all 3 questions completely for final round. I am now a power programmer there.
i would say just try for product based companies

No. of ways in which no column has all rows of same color : 24^n
No. of ways in which one one complete row is of same color : 33(8^n) = 9*(8^n)
No. of ways in which two complete rows are of same color : 33(2^n) + 233*(3^n) = 9*(2^n) + 18*(3^n)
No. of ways in which all rows are of same color: 3! + 233 = 6+18 = 24

Now simply apply inclusion exclusion
So our answer will be : 24^n - 9*(8^n) + 9*(2^n) + 18*(3^n) - 24

ha but do test cases run kiye aur uske bad time limit exceeds aa rha tha main pareshan ho gya is error se

In which company currently u r working Infosys???

Can anybody share the solution to max flow through pipe problem? When I google it, I get max flow min cut theorem :frowning: .

1 Like

joined Infosys just 2 weeks ago as joining date came out almost 1 year after hackwithinfy2018.

1 Like