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.
Earlier I tried with bisect, ans += index + 1 and then break, but the issue here is with duplicates. It seems all solutions here are sort of brute force with sets to remove duplicates, and it is always ans += 1 in the counting itself. I wonder if there could be any dynamic programming involved in it.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #87: Prime power triples
You are viewing a single comment's thread. Return to all comments →
Earlier I tried with
bisect
,ans += index + 1
and thenbreak
, but the issue here is with duplicates. It seems all solutions here are sort of brute force with sets to remove duplicates, and it is alwaysans += 1
in the counting itself. I wonder if there could be any dynamic programming involved in it.