⌘K
Flycodx

Arjun's Crypto Profit Maximization

Arjun's Crypto Profit Maximization

MediumArrays100% accepted

Arjun trades Bitcoin on a Mumbai crypto exchange platform. He has an array of Bitcoin prices throughout a trading day and wants to find the maximum profit by buying at one price and selling at a later price with only one transaction allowed.

Approach

Given an array of integers representing Bitcoin prices, find the maximum profit from a single buy-sell transaction.

Input

6 7 1 5 3 6 4

Output

5
solution.py
Loading editor...
Test 1
Test 2
Test 3

Press Run to test your custom input, or Submit to judge against all test cases.

Sign in to continue

Create a free account to run code, submit solutions and track progress.

  • Free forever — no credit card
  • 10+ languages with live execution
  • Points, streaks & leaderboards
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3