We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
A Chocolate Fiesta
A Chocolate Fiesta
Sort by
recency
|
37 Discussions
|
Please Login in order to post a comment
Find the best collection of Bridal Clutch online in Pakistan. Walkeaze offers the best quality bridal clutch for ladies online all over Pakistan. So, grab your favorite clutch online at low prices.
Java 8 solution:
The problem description is exactly why I hate HackerRank.
FYI nice explanation on the used combinatorial identity: https://math.stackexchange.com/questions/1072881/is-there-a-closed-form-formula-for-sum-of-odd-combinations
def solve(a): if len(a) == 0: return 0 evn = [nmbr for nmbr in a if nmbr%2==0] od = [nmbr for nmbr in a if nmbr%2!=0] ven = 2**(len(evn)) - 1 if len(od) > 0: do = 2**(len(od)-1) - 1 else: do = 0 tot = ven+do+do*ven return tot%1000000007