Company: Barclays Business analyst_4april
Difficulty: medium
Question A cold storage company has N storage units for various products. The company has received N orders that must be preserved at respective N temperatures inside the storage units. The company manager wishes to identify which products must be preserved at negative temperatures. Write an algorithm to help the manager find the number of products that have negative temperature storage requirements. Input The first line of the input consists of an integer numOfProducts , representing the number of products (N). The second line consists of N space-separated integers temperature 0 , temperature 1 ,....., temperature N-1 representing the temperatures at which the products must be preserved in the storage units. Output Print an integer representing the number of products that must be preserved at negative temperatures. Constraints 0 ≤ numOfProducts ≤ 10 6 -10 6 ≤ temperature i ≤ 10 6 0 ≤ i < numOfProducts Example Input: 7 9 -3 8 -6 -7 8 10 Output: 3 Explanation: The products that must