प्रश्न
पिछलाअगला
00:00

1. Two Sum

आसानहैश टेबलAmazonGoogleMicrosoft

Given an integer array nums and an integer target, return the indices of the two numbers that add up to target.

Each input has exactly one valid answer, and you may not use the same element twice.

उदाहरण 1:

इनपुट: nums = [2,7,11,15], target = 9
आउटपुट: [0,1]

उदाहरण 2:

इनपुट: nums = [3,2,4], target = 6
आउटपुट: [1,2]

सीमाएँ:

  • 2 <= nums.length <= 10^4
  • Exactly one valid answer exists.
मुख्य कोड मोड
● अपने आप सहेजा गयापंक्ति 1, कॉलम 1