Company: Intuit_26nov
Difficulty: medium
Bash: Array Sum Problem Given an array of strings, add all the numeric values within the array and print the sum to stdout. If there are no numeric values, print 0 . Implement the Bash function array_sum . The harness reads every input line into the array my_array and calls array_sum "${my_array[@]}" ; inside the function the elements are available as "$@" (copied into data ). The function prints the sum. An element is numeric when, after removing its leading and trailing spaces, it consists of an optional single sign ( + or - ) followed by one or more decimal digits 0-9 (inferred -- the source says only "numeric values"; signed integers are accepted, everything else is not) . In particular: 3rd , Efg231 , 12.5 , 1e3 , 0x10 , 1,000 , #7 and 7! are not numeric (they contain a non-digit character). 1 2 is not numeric (a space inside the element) (inferred) . + , - , --5 , +-3 , 5- are not numeric (a sign must be single, leading, and followed by digits) (inferred) . Leading zeros are allo