Company: infoedge_29thjuly
Difficulty: medium
Factor Lower Bound Problem Description You are given a positive integer N and an array nums of distinct non-negative integers. The value 0 is always present in nums . For a factor d of N , the lower bound of d is the greatest element of nums that is strictly smaller than d . For example, for the factor 3 and nums = [1, 2, 3, 4] , the lower bound is 2 : the element 3 itself does not count, because it is not strictly smaller than 3 . Consider every factor d of N with d > 1 , including N itself, each counted once. Find the sum of the lower bounds of all these factors. Because 0 is always in nums , every such factor has a lower bound. Complete the function Solution(N, nums) , which receives the integer N and the array nums and returns the sum of the lower bounds. Input Format Read from standard input. N m nums[0] nums[1] ... nums[m-1] Line 1 contains the integer N . Line 2 contains the integer m , the length of nums . Line 3 contains the m elements of nums , separated by spaces. The ele