File tree Expand file tree Collapse file tree 4 files changed +96
-0
lines changed
src/main/java/me/darksnakex/problems Expand file tree Collapse file tree 4 files changed +96
-0
lines changed Original file line number Diff line number Diff line change 1+ package me .darksnakex .problems ;
2+
3+ public class p1684 {
4+
5+ public int countConsistentStrings (String allowed , String [] words ) {
6+
7+ int res = 0 ;
8+
9+ for (String word : words ) {
10+ String pal = word ;
11+ for (int j = 0 ; j < allowed .length (); j ++) {
12+ pal = pal .replaceAll (String .valueOf (allowed .charAt (j )), "" );
13+ }
14+ if (pal .isEmpty ()) {
15+ res ++;
16+ }
17+ }
18+
19+ return res ;
20+
21+
22+ }
23+
24+ }
Original file line number Diff line number Diff line change 1+ package me .darksnakex .problems ;
2+
3+ public class p2413 {
4+
5+ public int smallestEvenMultiple (int n ) {
6+
7+ for (double i = 2 ; i <n *10 ; i ++){
8+ if (i % 2 == 0 && (i /n )%1 == 0 ){
9+ return (int )i ;
10+ }
11+ }
12+ return n ;
13+
14+ }
15+
16+ }
Original file line number Diff line number Diff line change 1+ package me .darksnakex .problems ;
2+
3+ public class p3280 {
4+
5+ public String convertDateToBinary (String date ) {
6+
7+ int anio = Integer .parseInt (date .substring (0 ,4 ));
8+ int mes = Integer .parseInt (date .substring (5 ,7 ));
9+ int dia = Integer .parseInt (date .substring (8 ,10 ));
10+
11+
12+ return Integer .toBinaryString (anio )+"-" +Integer .toBinaryString (mes )+"-" +Integer .toBinaryString (dia );
13+
14+ }
15+
16+ }
Original file line number Diff line number Diff line change 1+ package me .darksnakex .problems ;
2+
3+ import java .util .HashMap ;
4+ import java .util .Map ;
5+
6+ public class p3289 {
7+
8+ public int [] getSneakyNumbers (int [] nums ) {
9+
10+ Map <Integer ,Integer > map = new HashMap <>();
11+
12+ int val1 =-1 ;
13+ int val2 =-1 ;
14+ for (int num : nums ) {
15+ if (!map .containsKey (num )) {
16+ map .put (num , 1 );
17+ } else {
18+ map .put (num , map .get (num ) + 1 );
19+ }
20+
21+ }
22+ for (int valor : map .keySet ()) {
23+ if ((map .get (valor ))== 2 ){
24+ if (val1 == -1 ){
25+ val1 = valor ;
26+ } else if (val2 == -1 ) {
27+ val2 = valor ;
28+ }
29+ else {
30+ break ;
31+ }
32+ }
33+
34+ }
35+
36+ return new int []{val1 ,val2 };
37+
38+ }
39+
40+ }
You can’t perform that action at this time.
0 commit comments