SOLVED & EXPLAINED - Plus Minus (JavaScript) | Data Structures & Algorithm

Опубликовано: 23 Август 2023
на канале: Geekelo - Female Tech Enthusiast
111
like

QUESTION:
Given an array of integers, calculate the ratios of its elements that are positive, negative, and zero. Print the decimal value of each fraction on a new line with 6 places after the decimal.

Note: This challenge introduces precision problems. The test cases are scaled to six decimal places,

Print the following 3 lines, each to 6 decimals:

proportion of positive values
proportion of negative values
proportion of zeros
Sample Input

STDIN Function
----- --------
6 arr[] size n = 6
-4 3 -9 0 4 1 arr = [-4, 3, -9, 0, 4, 1]
Sample Output

0.500000
0.333333
0.166667

Join FREE Membership Community - https://tinyurl.com/geekspecials
Connect on LinkedIn -   / eloghene-otiede  


На этой странице сайта вы можете посмотреть видео онлайн SOLVED & EXPLAINED - Plus Minus (JavaScript) | Data Structures & Algorithm длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Geekelo - Female Tech Enthusiast 23 Август 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 111 раз и оно понравилось like зрителям. Приятного просмотра!