This file contains hidden or 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
hello |
This file contains hidden or 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 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); |
This file contains hidden or 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
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++; |
This file contains hidden or 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 static void main(String[] args) { | |
System.out.println("I am in love with"); | |
System.out.println("Escape Sequences in Java"); | |
} |
This file contains hidden or 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 static void main(String[] args) { | |
System.out.println("I am in love with \nEscape Sequences in Java"); | |
} |
This file contains hidden or 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 static void main(String[] args) { | |
System.out.println("I am in love with\tEscape Sequences in Java"); | |
} |
This file contains hidden or 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 static void main(String[] args) { | |
int a = 5; | |
int b = 5; | |
System.out.println(a==b); | |
} |
This file contains hidden or 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 static void main(String[] args) { | |
int a = 5; | |
int b = 5; | |
System.out.println(a!=b); | |
} |
This file contains hidden or 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 static void main(String[] args) { | |
String a= "Java"; | |
String b= "Python"; | |
System.out.println(a.equals(b)); | |
} |
This file contains hidden or 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 static void main(String[] args) { | |
String a= "Java"; | |
String b= "Python"; | |
System.out.println(!a.equals(b)); | |
} |
OlderNewer