Question: PLEASE PROVIDE ALL THE ANWERS IN PYTHON PROGRAMMING TO THE QUESTIONS WITH PROPER SCRRENSHOT OF OUTPUT AND DIAGRAM REQUIRED IN QUESTION WITH EXPLANATION. Qn.1 :
PLEASE PROVIDE ALL THE ANWERS IN PYTHON PROGRAMMING TO THE QUESTIONS WITH PROPER SCRRENSHOT OF OUTPUT AND DIAGRAM REQUIRED IN QUESTION WITH EXPLANATION.
Qn.1 : PLEASE ANSWER IN PYTHON PROGRAMMIN WITH PROPER CODE, SCREEENSHOT AND CODE NOT USED IN LEETCODE.

Qn.2 : PLEASE ANSWER IN PYTHON PROGRAMMIN WITH PROPER CODE, SCREEENSHOT AND CODE NOT USED IN LEETCODE.

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 . Example 1: Input: prices =[7,1,5,3,6,4] Output: 5 Explanation: Buy on day 2 (price =1 ) and sell on day 5( price =6 ), profit =61=5. Note that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell. Example 2: Input: prices =[7,6,4,3,1] Output: Explanation: In this case, no transactions are done and the max profit = 0 . 70. Climbing Stairs Hint You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or steps. In how many distinct ways can you climb to the top? Example 1: Input: n=2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 step +1 step 2. 2 steps Example 2: Input: n=3 Output: 3 Explanation: There are three ways to climb to the top. 1. 1 step +1 step +1 step 2. 1 step +2 steps 3. 2 steps +1 step
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
