American Young Coder

AYC logo
Loading Events

« All Events

  • This event has passed.

6 PM – Coding Olympic Training

January 17, 2022 @ 6:00 pm - 7:00 pm

Homework

Two Sum

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

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.

1st Example:

Input: nums = [2,7,11,15], target = 18

Expected output for this example would be [1,2]. This is because nums[1] + nums[2] = 18.

2nd Example:

Input: nums = [1,2,3,4], target = 5

Expected output for this example would be [0,3]. This is because nums[0] + nums[3] = 5.

You can also check the slide to find this problem. The slide should already shared to you guys in the google drive.

Details

Date:
January 17, 2022
Time:
6:00 pm - 7:00 pm