
Comparar dos Arreglos y mostrar los elementos en común
Java
Publicado el 25 de Mayo del 2020 por Luu
1.240 visualizaciones desde el 25 de Mayo del 2020
Crear un método que reciba como parámetro dos arreglos y muestre los elementos en común
picoEstrella(3); // [" *", " * *", "* *"]
picoEstrella(5); // [" *", " * *", " * *", " * *", "* *"]
document.write("<pre>");
document.write(picoEstrella(10).join("\n"));
document.write("</pre>");
console.log(piramide(10).join("\n"));
IntToString([[5, 4, [3, [2], 1]], [5, 4, []], [5, [4]]]) # [['5', '4', ['3', ['2'], '1']], ['5', '4', []], ['5', ['4']]]
IntToString([1, 2, 3, 4]) # ['1', '2', '3', '4']
IntToString([1, 2, 3.5, 4.7]) # ['1', '2', '3.5', '4.7']
getElementsDictionary({'age': 25, 'name': "tom", 'city': "NY"}, ["name"]) # {'name': "tom"}
getElementsDictionary({'age': 25, 'name': "tom", 'city': "NY"}, ["name", "country"]) # {'name': "tom"}
getElementsDictionary({'age': 25, 'name': "tom", 'city': "NY"}, ["name", "age"]) # {'name': "tom", 'age': 25}
getElementsDictionary({'age': 25, 'name': "tom", 'city': "NY"}, ["parent", "state"]) # {}
getElementsDictionary({}, ["name", "age"]) # {}
getElementsDictionary({'age': 25, 'name': "tom", 'city': "NY"}, []) # {}
matches({'age': 25, 'name':"tom", 'city': "NY"}, {"name":"tom"}) # true
matches({'age': 25, 'name':"tom", 'city': "NY"}, {"name":"tom"}) # true
matches({'age': 25, 'name':"tom", 'city': "NY"}, {'name':"tom"}) # true
matches({'age': 25, 'name':"tom", 'city': "NY"}, {'age': 25, 'name':"tom"}) # true
matches({'age': 25, 'name':"tom", 'city': "NY"}, {'age': 30, 'name':"tom"}) # false
matches({'age': 25, 'name':"tom", 'city': "NY"}, {}) # true
matches({}, {'name':"tom"}) # false