Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ParanoidUser committed Jul 28, 2023
1 parent 9a35d01 commit ae1c9d2
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Codewars Handbook ☕️🚀

[![Views statistics +1 👀](https://img.shields.io/badge/dynamic/xml?color=success&label=views&query=//*[name()=%27text%27][3]&url=https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FParanoidUser%2Fcodewars-handbook)](https://hits.seeyoufarm.com/api/count/graph/dailyhits.svg?url=https://github.com/ParanoidUser/codewars-handbook)
[![Solved kata 👌](https://img.shields.io/badge/solved%20kata-1345-red.svg)](https://www.codewars.com/kata/search/java)
[![Solved kata 👌](https://img.shields.io/badge/solved%20kata-1346-red.svg)](https://www.codewars.com/kata/search/java)
[![CI pipeline 🛠](https://img.shields.io/github/actions/workflow/status/ParanoidUser/codewars-handbook/build.yml?branch=main)](https://github.com/ParanoidUser/codewars-handbook/actions/workflows/build.yml)
[![Quality gate 🔎](https://img.shields.io/sonar/alert_status/codewars-handbook?server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/dashboard?id=codewars-handbook)
[![Let's have a chat! 📞](https://img.shields.io/gitter/room/ParanoidUser/codewars-handbook?color=49c39e)](https://gitter.im/ParanoidUser/codewars-handbook)
Expand All @@ -25,7 +25,7 @@ slug.

| [1 kyu](/kata/1-kyu/index.md) | [2 kyu](/kata/2-kyu/index.md) | [3 kyu](/kata/3-kyu/index.md) | [4 kyu](/kata/4-kyu/index.md) | [5 kyu](/kata/5-kyu/index.md) | [6 kyu](/kata/6-kyu/index.md) | [7 kyu](/kata/7-kyu/index.md) | [8 kyu](/kata/8-kyu/index.md) | [beta](/kata/beta/index.md) | [retired](/kata/retired/index.md) |
|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:-----------------------------:|:---------------------------:|:---------------------------------:|
| - | 1 | 2 | 18 | 36 | 410 | 545 | 200 | 57 | 76 |
| - | 1 | 2 | 18 | 36 | 410 | 546 | 200 | 57 | 76 |

**Note:** The source code is written in Java 17 and may use language features that are incompatible
with Java 8, 11.
Expand Down
1 change: 1 addition & 0 deletions kata/7-kyu/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@
- [Trigrams](trigrams)
- [TV Remote](tv-remote)
- [Two fighters, one winner](two-fighters-one-winner)
- [Two numbers are positive](two-numbers-are-positive)
- [Two to One](two-to-one)
# U
- [Uglify Word](uglify-word)
Expand Down
17 changes: 17 additions & 0 deletions kata/7-kyu/two-numbers-are-positive/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# [Two numbers are positive](https://www.codewars.com/kata/two-numbers-are-positive "https://www.codewars.com/kata/602db3215c22df000e8544f0")

## Task:

Your job is to write a function, which takes three integers `a`, `b`, and `c` as arguments, and returns `True` if
exactly two of the three integers are positive numbers (greater than zero), and `False` - otherwise.

## Examples:

```
twoArePositive(2, 4, -3) == true
twoArePositive(-4, 6, 8) == true
twoArePositive(4, -6, 9) == true
twoArePositive(-4, 6, 0) == false
twoArePositive(4, 6, 10) == false
twoArePositive(-14, -3, -4) == false
```
5 changes: 5 additions & 0 deletions kata/7-kyu/two-numbers-are-positive/main/Kata.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
interface Kata {
static boolean twoArePositive(int a, int b, int c) {
return a > 0 ? b > 0 != c > 0 : b > 0 && c > 0;
}
}
17 changes: 17 additions & 0 deletions kata/7-kyu/two-numbers-are-positive/test/SolutionTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

class SolutionTest {
@Test
void sample() {
assertTrue(Kata.twoArePositive(2, 4, -3));
assertTrue(Kata.twoArePositive(-4, 6, 8));
assertTrue(Kata.twoArePositive(4, -6, 9));
assertTrue(Kata.twoArePositive(4, 6, 0));
assertFalse(Kata.twoArePositive(-4, 6, 0));
assertFalse(Kata.twoArePositive(4, 6, 10));
assertFalse(Kata.twoArePositive(-14, -3, -4));
}
}

0 comments on commit ae1c9d2

Please sign in to comment.