Skip to content

Commit d405ef1

Browse files
ZahidFKhanclaude
andcommitted
docs(easy-problems): add class-level JavaDoc with description and input/output examples
All easy problem test classes under a_easy_problems/numbers and a_easy_problems/strings now have a consistent class-level JavaDoc comment describing the problem and showing a concrete example with Input, Output, and where useful an Explanation line. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4d1baab commit d405ef1

20 files changed

Lines changed: 143 additions & 58 deletions

src/test/java/com/github/streams/practice/a_easy_problems/numbers/B_MapCelsiusToFahrenheit.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
* F = (C * 9/5) + 32.
1212
* This requires using the map function to transform each element and ensure the result is collected into
1313
* a List<Double>.
14+
* <p>Example: <br>
15+
* Input: [0, 10, 25, 37, 100] <br>
16+
* Output: [32.0, 50.0, 77.0, 98.6, 212.0]
1417
*/
1518
class B_MapCelsiusToFahrenheit {
1619

src/test/java/com/github/streams/practice/a_easy_problems/numbers/C_UniqueEmailAddresses.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77

88
/**
99
* Imagine you’re building a registration system for a website. Sometimes, due to user error or
10-
* system retries, duplicate emails get stored in your list.
11-
* You want to keep only unique email addresses before sending a newsletter.
10+
* system retries, duplicate emails get stored in your list. You want to keep only unique email
11+
* addresses before sending a newsletter.
12+
*
13+
* <p>Example: <br>
14+
* Input: ["john.doe@example.com", "alice@example.com", "john.doe@example.com",
15+
* "bob@example.com", "alice@example.com"] <br>
16+
* Output: ["john.doe@example.com", "alice@example.com", "bob@example.com"]
1217
*/
1318
class C_UniqueEmailAddresses {
1419
@Test

src/test/java/com/github/streams/practice/a_easy_problems/numbers/G_DescendingNumberValue.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
import org.junit.jupiter.api.Disabled;
66
import org.junit.jupiter.api.Test;
77

8-
/*
9-
* Given a numeric array , re arrange the elements to form a highest possible value.
10-
* Input: {1, 34, 3, 98, 9, 76, 45, 4};
11-
* Output: 998764543431
12-
* Explanation: 9,98,76,45,4,34,3,1
13-
* */
8+
/**
9+
* Re-arranges the elements of a numeric array to form the highest possible value.
10+
*
11+
* <p>Example: <br>
12+
* Input: [1, 34, 3, 98, 9, 76, 45, 4] <br>
13+
* Output: "998764543431" <br>
14+
* Explanation: Numbers re-arranged as 9, 98, 76, 45, 4, 34, 3, 1.
15+
*/
1416
class G_DescendingNumberValue {
1517

1618
@Test

src/test/java/com/github/streams/practice/a_easy_problems/numbers/H_ReverseANumber.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
import org.junit.jupiter.api.Disabled;
66
import org.junit.jupiter.api.Test;
77

8+
/**
9+
* Reverse the digits of an integer.
10+
*
11+
* <p>Example: <br>
12+
* Input: 12345 <br>
13+
* Output: 54321
14+
*/
815
class H_ReverseANumber {
916

1017
@Test

src/test/java/com/github/streams/practice/a_easy_problems/numbers/J_MeanOfNumbers.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
import org.junit.jupiter.api.Disabled;
66
import org.junit.jupiter.api.Test;
77

8+
/**
9+
* Calculate the mean (average) of a list of integers.
10+
*
11+
* <p>Example: <br>
12+
* Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] <br>
13+
* Output: 10.5
14+
*/
815
class J_MeanOfNumbers {
916
@Test
1017
@Disabled

src/test/java/com/github/streams/practice/a_easy_problems/numbers/K_IntArray2DToListConverter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
import org.junit.jupiter.api.Disabled;
77
import org.junit.jupiter.api.Test;
88

9+
/**
10+
* Convert a 2D integer array into a List of Lists of Integers using streams.
11+
*
12+
* <p>Example: <br>
13+
* Input: {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} <br>
14+
* Output: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
15+
*/
916
public class K_IntArray2DToListConverter {
1017
@Test
1118
@Disabled

src/test/java/com/github/streams/practice/a_easy_problems/strings/C_LengthOfCityTest.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@
88
import org.junit.jupiter.api.Test;
99

1010
/**
11-
* Calculates the length of city names that start with 'm' or 'M'. <br>
12-
* <br>
11+
* Calculates the length of city names that start with 'm' or 'M' and returns a map of city name
12+
* to its length.
1313
*
14-
* <h3>Example Cities</h3>
15-
*
16-
* <ul>
17-
* <li>Mumbai
18-
* <li>Munnar
19-
* <li>Chennai
20-
* <li>Hyderabad
21-
* </ul>
14+
* <p>Example: <br>
15+
* Input: ["Mumbai", "Munnar", "Chennai", "Hyderabad"] <br>
16+
* Output: {"Mumbai"=6, "Munnar"=6} <br>
17+
* Explanation: Only cities starting with 'M' or 'm' are included.
2218
*/
2319
class C_LengthOfCityTest {
2420
@Test

src/test/java/com/github/streams/practice/a_easy_problems/strings/D_NumberOfOccurencesOfEachCharacterTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
import org.junit.jupiter.api.Disabled;
77
import org.junit.jupiter.api.Test;
88

9+
/**
10+
* Count the number of occurrences of each character in a string (spaces excluded).
11+
*
12+
* <p>Example: <br>
13+
* Input: "the quick brown fox jumps right over the little lazy dog little" <br>
14+
* Output: {'t'=5, 'h'=3, 'e'=5, 'q'=1, 'u'=2, ...} <br>
15+
* Explanation: Each character is mapped to how many times it appears in the string.
16+
*/
917
class D_NumberOfOccurencesOfEachCharacterTest {
1018
@Test
1119
@Disabled("Remove This Once you Complete The Exercise")

src/test/java/com/github/streams/practice/a_easy_problems/strings/E_NumberOfOccurencesOfEachWordTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
import org.junit.jupiter.api.Disabled;
77
import org.junit.jupiter.api.Test;
88

9+
/**
10+
* Count the number of occurrences of each word in a string.
11+
*
12+
* <p>Example: <br>
13+
* Input: "the quick brown fox jumps right over the little lazy dog little" <br>
14+
* Output: {"the"=2, "little"=2, "quick"=1, "brown"=1, ...} <br>
15+
* Explanation: Each word is mapped to how many times it appears in the string.
16+
*/
917
class E_NumberOfOccurencesOfEachWordTest {
1018
@Test
1119
@Disabled

src/test/java/com/github/streams/practice/a_easy_problems/strings/F_ConcatenationOfStrings.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
import org.junit.jupiter.api.Disabled;
66
import org.junit.jupiter.api.Test;
77

8+
/**
9+
* Given a list of strings, concatenate all strings separated by a comma using Java Streams.
10+
*
11+
* <p>Example: <br>
12+
* Input: ["Hellow", "World", "Hello", "World"] <br>
13+
* Output: "Hellow,World,Hello,World"
14+
*/
815
class F_ConcatenationOfStrings {
9-
/**
10-
* Given a list of strings, write a method to concatenate all the strings in the list, separated
11-
* by a comma, using Java 8 Streams.
12-
*/
16+
1317
@Test
1418
@Disabled
1519
void testConcatenationOfStrings() {

0 commit comments

Comments
 (0)