def two_sum(nums, target): seen = {} for i, v in enumerate(nums): comp = target - v if comp in seen: return [seen[comp], i] seen[v] = i
While the full book is a paid publication by , several legitimate resources and previews are available online: Learn To Code By Solving Problems Pdf
You can find the book and related resources through major retailers and platforms: : Available directly from No Starch Press , including a "Look Inside" feature for Chapter 2. Digital Libraries : Access is available on O'Reilly Media Google Books Code Samples : A collection of code from the book is hosted on def two_sum(nums, target): seen = {} for i,