Question Set 3
This is question set 3. Another day another set.Happy Coding!
"Talk is Cheap Just code it"
Problem 1-Kadane's Algorithm(Easy)
Given an integer array , find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
-2 1 -3 4 -1 2 1 -5 4
6 [4+(-1)+2+1]
Link to the question-https://leetcode.com/problems/maximum-subarray/
Problem 2-GCD(Easy)
GCD (Greatest Common Divisor) or HCF (Highest Common Factor) of two numbers is the largest number that divides both of them.Find the GCD of two numbers.
PS-Try to learn Euclid method of calculating GCD
Link to the question-https://www.geeksforgeeks.org/c-program-find-gcd-hcf-two-numbers/
Problem 3-GCD of Array(Easy)
Given an array of numbers, find GCD of the array elements.
SAMPLE INPUT
Link to the question-https://www.geeksforgeeks.org/gcd-two-array-numbers/
Problem 4-Kadane's Algorithm Modified (Medium)
Given n numbers (both +ve and -ve), arranged in a circle, fnd the maximum sum of consecutive number.
SAMPLE INPUTLink to the question-https://www.geeksforgeeks.org/maximum-contiguous-circular-sum/
Comments
Post a Comment