Given an array of distinct integers. The task is to count all the triplets such that sum of two elements equals the third element.
Write the pseudo code to check for the above,write the python implementation and draw a flow chart.
Example 1:
Input:
N= 4
arr[] = {1, 5, 3, 2}
Output: 2
Explanation: There are 2 triplets: 1 + 2 = 3 and 3 +2 = 5
Question 1:
Input:
N=5
Arr []={1,3,2,6,5}
Question 2:
Input:
N= 3
arr[] = {2, 3, 4}
Question 3
Input:
N = 10
arr[] = {2,12,5,6,7,8,2,10, 3, 4}
Note: use star Uml for flow chart, use python to implement use Microsoft words to present the answers including the pseudo codes and the screenshots of the flow chart .
Part 2
Given an array Arr[] of N integers. Find the contiguous sub-array(containing at least one number) which has the maximum sum and return its sum.
Example 1:
Input:
N= 5
Arr[] = {1,2,3,-2,5} Output:
9
Explanation:
Max subarray sum is 9
of elements (1, 2, 3, -2, 5) which is a contiguous subarray.
Question 1:
Question 1:
Input:
N=5
Arr []={1,3,2,6,-5}
Question 2:
Input:
N=4
Arr []={1,2,5,7}
Answer all questions Note: use star Uml for flow chart, use python to implement use Microsoft words to present the answers including the pseudo codes and the screenshots of the flow chart
Answer all questions
Note: use star Uml for flow chart, use python to implement use Microsoft words to present the answers including the pseudo codes and the screenshots of the flow chart
Given an array of distinct integers. The task is to count all the triplets such that sum of two elements equals the thir
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am