Generation

generate functionWed, 19 Apr 2023

Encontrar la clave que contiene una subcadena: Crea un mapa con claves que son cadenas y escribe una función que encuentre la clave que contiene una subcadena determinada.

defmodule Solution do def find_matching_key(map, substring) do #TODO end end map = %{ "this" => "that", "another" => "one" } Solution.find_matching_key(map, "this") # => "this" Solution.find_matching_key(map, "an") # => "another" Solution.find_matching_key(map, "notthere") # => nil

Questions about programming?Chat with your personal AI assistant