From 1d8cacc5c67d854d185d91b7f5a466339c0e891e Mon Sep 17 00:00:00 2001 From: hamza Date: Mon, 20 Jun 2022 22:52:28 +0100 Subject: [PATCH] subject(Count-Negative):add readme --- subjects/countnegative/README.md | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 subjects/countnegative/README.md diff --git a/subjects/countnegative/README.md b/subjects/countnegative/README.md new file mode 100644 index 00000000..06087874 --- /dev/null +++ b/subjects/countnegative/README.md @@ -0,0 +1,38 @@ +## count-negative + +### Instructions + +Write a function that takes an array of integers and returns the number of negative numbers in the array. +- If the array is empty, the function should return `0`. + +### Expected function +```go +func CountNegative(numbers []int) int { + // your code here +} +``` + +### Usage + +```go +package main + +import "fmt" + +func main(){ + fmt.Println(CountNegative([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})) + fmt.Println(CountNegative([]int{-1, -2, -3, -4, -5, -6, -7, -8, -9, -10})) + fmt.Println(CountNegative([]int{})) + fmt.Println(CountNegative([]int{-1,2,0,-3})) +} +``` + +and the output should be: + +```console +$ go run . +0 +10 +0 +2 +``` \ No newline at end of file