Given an integer N, find the number of elements which are even in the first N rows of the Pascal’s t…
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
The main idea is to first solve how many odd numbers are there in the n-th row. The answer is 2^x, where x is the number of 1’s in the binary representation of n. You’ll need digit-dp to calculate how many odd numbers are there in the first n rows.