Plus Minus | Python Programming | Problem Solving | Interview Prepration

Опубликовано: 19 Январь 2022
на канале: CodeJedi
175
2

In this video, we will be looking into an interview question called Plus Minus.

Problem statement:
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.

Example:
arr = [1,1,0,-1,-1]
There are n=5 elements, two positive, two negative and one zero. Their ratios are 2/5 = 0.40000, 2/5 = 0.40000 and 1/5 = 0.20000. Results are printed as:
0.400000
0.400000
0.200000

Function Description:
Complete the plus-minus function in the editor below.
plusMinus has the following parameter(s):
int arr[n]: an array of integers

Hackerrank Link: https://www.hackerrank.com/challenges...

For more videos subscribe to the channel.

#python #programming #interview #algorithms


Смотрите видео Plus Minus | Python Programming | Problem Solving | Interview Prepration онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь CodeJedi 19 Январь 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 175 раз и оно понравилось 2 людям.