American Young Coder Academy – Indo

Loading Events

« All Events

  • This event has passed.

Competitive Programming

August 17, 2022 @ 6:00 pm - 8:00 pm

Homework:

1.

You are given an integer array nums. The unique elements of an array are the elements that appear exactly once in the array.

Return the sum of all the unique elements of nums.

Input: nums = [1,2,3,2]

Output: 4

 

2.

You are given an array prices where prices[i] is the price of a given stock on the ith day.

You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.

Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.

Input: prices = [7,1,5,3,6,4]

Output: 5

Details

Date:
August 17, 2022
Time:
6:00 pm - 8:00 pm
Verified by MonsterInsights