---
title: "Discussion on \"1. Two Sum Hash Map Approach\" | Hashnode"
description: "Discussion on \"1. Two Sum Hash Map Approach\". https://leetcode.com/problems/two-sum/description/\nCore Idea\nWhile iterating:\n\nFor each number n\n\nCalculate diff = target - n\n\nIf diff already seen → answer found\n\nElse store current number in dictionary\n\n\n\n\nCode\nclass Solution(object):\n    def twoSu..."
url: "https://hashnode.com/posts/1-two-sum-hash-map-approach/698eced3e42289cc8d71650f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [1\. Two Sum Hash Map Approach](https://two-sum.hashnode.dev/1-two-sum-hash-map-approach?utm_source=hashnode&utm_medium=feed)

https://leetcode.com/problems/two-sum/description/ Core Idea While iterating: For each number n Calculate diff = target - n If diff already seen → answer found Else store current number in dictionary Code class Solution(object): def twoSu...

Feb 13 · 1 min read · two-sum.hashnode.dev  
Read the article

-   [#google](https://hashnode.com/tag/google)
-   [#meta](https://hashnode.com/tag/meta)
-   [#amazon](https://hashnode.com/tag/amazon)
-   [#arrays](https://hashnode.com/tag/arrays)
-   [#hash-table](https://hashnode.com/tag/hash-table)

## Written by

[Deepak Kambala](https://hashnode.com/@deepakkambala)

@deepakkambala

  
[View profile](https://hashnode.com/@deepakkambala)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
