Skip to content

Commit

Permalink
Improving solution
Browse files Browse the repository at this point in the history
  • Loading branch information
josdem committed Apr 5, 2024
1 parent cef1124 commit bd95003
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion simple-algorithms/longest-substring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java'
}

def junitVersion = '5.9.3'
def junitVersion = '5.10.2'

group 'com.josdem.kata'
version '1.0-SNAPSHOT'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ public class LongestSubstring {
public int reduce(String data) {
List<String> substrings =
Arrays.stream(data.split("")).distinct().toList();
return substrings.size() > 0 ? substrings.size() : 1;
return !substrings.isEmpty() ? substrings.size() : 1;
}
}

0 comments on commit bd95003

Please sign in to comment.