View gist:dfd90928f597e25bf0be4b60dffdeffd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.LinkedHashSet; | |
import java.util.Set; | |
public class Test { | |
public static void main(String[] args) { | |
int[] arr = {4, 5, 7, -5 - 3, 2, 8, 5, -1, 3, 8}; | |
int[] distinctIntArray = makeDistinct(arr); | |
getPairsCount(distinctIntArray, 9); | |
} |
View dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependencies> | |
<dependency> | |
<groupId>javax.el</groupId> | |
<artifactId>javax.el-api</artifactId> | |
<version>2.2.4</version> | |
</dependency> | |
<dependency> | |
<groupId>org.glassfish.web</groupId> |
View gist:de45340f821d9528d928f3c0941a3fa1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Test { | |
public static void main(String[] args) { | |
String textWithsymbols = "Th!s is For $ & NoT 4 Honey ... !@#$?<>%^&Y~*()_-=+aah جاوا فور اور"; | |
String s = textWithsymbols.replaceAll("[\\\\s\\\\d!\\\"#$%&\\'()*+,-./:;\\\\\\\\<>=?@\\\\^_`{}|~\\\\[\\\\]]",""); | |
System.out.println(s); | |
} | |
} |