Skip to content

Instantly share code, notes, and snippets.

@aniketmlk6
aniketmlk6 / aa
Last active April 28, 2020 18:54
hello
public static void main(String[] args) {
int[] arr = {10,10,11,12,12,12};
HashMap<Integer, Integer> hash = new HashMap<>();
// saving frequency for each element in hashmap
for (int element : arr) {
if (hash.containsKey(element)) {
int value = hash.get(element);
static int rarestElement(int[] arr)
{
HashMap<Integer, Integer> hash = new HashMap<>();
// saving frequency for each element in hashmap
for (int element : arr) {
if (hash.containsKey(element)) {
int value = hash.get(element);
value++;
public static void main(String[] args) {
System.out.println("I am in love with");
System.out.println("Escape Sequences in Java");
}
public static void main(String[] args) {
System.out.println("I am in love with \nEscape Sequences in Java");
}
public static void main(String[] args) {
System.out.println("I am in love with\tEscape Sequences in Java");
}
public static void main(String[] args) {
int a = 5;
int b = 5;
System.out.println(a==b);
}
public static void main(String[] args) {
int a = 5;
int b = 5;
System.out.println(a!=b);
}
public static void main(String[] args) {
String a= "Java";
String b= "Python";
System.out.println(a.equals(b));
}
public static void main(String[] args) {
String a= "Java";
String b= "Python";
System.out.println(!a.equals(b));
}