You have to convert base 2 number into base 6 constraint : length of array <1000
You have to find sum of product of cool subset : cool subset is having number of odd element even total size of subset is k constraint size of array <1000;
- you have to find number of numbers of exact digit n whose digit sum is compact number. compact number is the number which is made by the given x, y for ex if x and y are 2 and 3 respectively then 22, 33, 23, 32 are compact numbers. x<=9 y<=9 n<=1000
For question 2 consider this solution
3rd one will give TLE(for a few cases). Try to do it in $$$O(n^2)$$$ and constant factor of $$$9$$$ and not $$$81$$$. The time limit was strict.
Yes, it did actually for 3 test cases. Any hint for reducing the constant factor to 9?
Let us convert it to another problem: Given $$$n$$$, $$$dp[i]$$$ represents number of values that contain at most $$$n$$$ digits and their sum is $$$i$$$.
pseudo-code:
@
nice!
My recursive dp solution passed all the test cases when i changed mod operation to subtraction.
Is the 3rd problem of digit dp? What to what major topic does 2nd problem belong to- DP SOS?
It can be considered as digit dp, but can be reduced down to simpler combinatorics dp if you try to observe the states in digit dp.
it's O(N*N) not O(N), each time you do an add operation that takes length of string in for loop which make the add function O(N) and you call this function N times, so it make complexity O(N*N)
You are correct. I have edited my comment.
can you explain the logic of your code . I am not able to understand it.
So the power vector represents 2^i for ith iteration in loop.Now if that number is set it is to be added to the answer uptil there . He wrote addition of 2 string in base 6 in the add function . The C in that function represents carry . Hope you understand now.
I guess the constraint in problem 1 was (length of array < 100)
Also, Those who partially solved for the constraint of length <= 64 got (81/100) points!
Will uber hire me if i can drive well?
Only if you are mechanical engineer.
Consider this for 2nd problem,